This Rmarkdown is part of the following article:
Esser, L.F., Bailly, D., Lima, M.R., Ré, R. 2024. chooseGCM: a toolkit to select General Circulation Models in R. In prep.
chooseGCM is a solution for GCMs selection in Climate Change research. We built this Rmarkdown as a way to test the properties of the methods underlying chooseGCM. Results from each function will be presented side by side with changing variables, allowing better comparison.
This RMarkdown was built upon tests made from reviewer 1 to inform regarding timespans to each function. The only function we will not be covering is the , which takes a lot of time to download data and the timespan depends majorly on the internet connection and not on the coding optimization.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(sf)
## Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(chooseGCM)
library(tictoc)
tictoc::tic()
s <- chooseGCM::import_gcms(path = "~/storage/WC_data/WC_data_all_gcms_10")
tictoc::toc()
## 0.184 sec elapsed
s
## $ac_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ac_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -1.7, -103.3, 9.4, -24.7, -65.3, ...
## max values : 38.1, 21.5, 93.9, 2242.1, 56.3, 30.4, ...
##
## $ae_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ae_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.5, -1.0, -6.3, 11.5, -25.2, -67.5, ...
## max values : 36.8, 21.3, 94.1, 2229.1, 55.5, 29.1, ...
##
## $cc_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cc_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -45.1, -1.9, -28.6, 15.2, -22.8, -65.0, ...
## max values : 39.8, 21.4, 94.6, 2222.1, 58.3, 30.9, ...
##
## $ce_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ce_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.2, -1.1, -12.0, 13.9, -25.4, -67.5, ...
## max values : 37.0, 22.4, 94.8, 2282.1, 55.5, 29.2, ...
##
## $ch_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ch_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -2.4, -33.1, 15.3, -23.3, -67.5, ...
## max values : 37.6, 22.0, 92.9, 2244.5, 58.4, 29.7, ...
##
## $cn_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cn_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -3.0, -34.3, 14.4, -23.7, -66.6, ...
## max values : 37.6, 22.2, 94.8, 2158.7, 56.7, 29.7, ...
##
## $cr_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cr_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.7, -16.9, 9.3, -24.3, -67.8, ...
## max values : 37.2, 22.3, 95.3, 2178.1, 55.9, 29.6, ...
##
## $ec_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ec_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -2.6, -17.2, 11.9, -26.0, -68.5, ...
## max values : 37.6, 21.3, 95.8, 2355.0, 55.6, 30.0, ...
##
## $ev_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ev_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.9, -2.4, -13.4, 11.6, -26.2, -67.1, ...
## max values : 37.5, 21.3, 95.9, 2355.1, 55.5, 29.3, ...
##
## $fi_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : fi_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.3, -2.0, -17.9, 12.4, -24.6, -66.7, ...
## max values : 36.8, 21.3, 94.5, 2189.6, 54.8, 28.9, ...
##
## $gg_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gg_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.1, 0.0, 0, 7.2, -24.8, -66.2, ...
## max values : 36.8, 21.5, 96, 2266.3, 54.8, 28.4, ...
##
## $gh_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gh_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.7, -0.1, -0.3, 8.6, -25.1, -65.9, ...
## max values : 37.1, 22.6, 95.2, 2253.2, 55.4, 28.5, ...
##
## $hg_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : hg_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -2.4, -71.3, 11.8, -24.9, -66.6, ...
## max values : 38.4, 21.1, 95.2, 2287.1, 56.9, 30.8, ...
##
## $ic_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ic_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.0, -2.2, -14.9, 11.2, -25.6, -69.1, ...
## max values : 35.1, 22.1, 94.5, 2320.0, 52.5, 26.7, ...
##
## $in_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : in_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.5, -1.5, -17.2, 6.3, -25.4, -67.1, ...
## max values : 35.4, 22.6, 94.6, 2336.0, 53.3, 27.6, ...
##
## $ip_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ip_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -1.9, -13.2, 9.7, -25.8, -65.5, ...
## max values : 37.8, 21.2, 94.3, 2188.0, 56.2, 29.5, ...
##
## $me_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : me_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.7, -0.9, -4.1, 10.5, -27.2, -69.2, ...
## max values : 36.3, 22.5, 94.5, 2238.5, 54.6, 28.1, ...
##
## $mi_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mi_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.3, -1.9, -10.6, 13.4, -26, -68.4, ...
## max values : 36.3, 22.5, 95.4, 2250.5, 55, 27.8, ...
##
## $ml_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ml_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.3, -0.7, -3.8, 11.9, -26.5, -68.8, ...
## max values : 35.0, 21.1, 95.4, 2249.7, 54.2, 27.4, ...
##
## $mp_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mp_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.8, -0.5, -2.9, 14.7, -26.3, -67.1, ...
## max values : 34.9, 21.1, 95.4, 2278.1, 53.5, 27.7, ...
##
## $mr_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mr_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -1.3, -8.1, 15.6, -24.3, -68.3, ...
## max values : 36.4, 21.9, 94.4, 2149.6, 55.0, 28.2, ...
##
## $uk_ssp585_10_2090
## class : SpatRaster
## dimensions : 1080, 2160, 19 (nrow, ncol, nlyr)
## resolution : 0.1666667, 0.1666667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : uk_ssp585_10_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.6, -2.8, -49.7, 10.5, -24.1, -66.6, ...
## max values : 38.7, 20.8, 94.6, 2324.7, 57.3, 30.6, ...
names(s)
## [1] "ac_ssp585_10_2090" "ae_ssp585_10_2090" "cc_ssp585_10_2090"
## [4] "ce_ssp585_10_2090" "ch_ssp585_10_2090" "cn_ssp585_10_2090"
## [7] "cr_ssp585_10_2090" "ec_ssp585_10_2090" "ev_ssp585_10_2090"
## [10] "fi_ssp585_10_2090" "gg_ssp585_10_2090" "gh_ssp585_10_2090"
## [13] "hg_ssp585_10_2090" "ic_ssp585_10_2090" "in_ssp585_10_2090"
## [16] "ip_ssp585_10_2090" "me_ssp585_10_2090" "mi_ssp585_10_2090"
## [19] "ml_ssp585_10_2090" "mp_ssp585_10_2090" "mr_ssp585_10_2090"
## [22] "uk_ssp585_10_2090"
names(s) <- gsub("_ssp585_10_2090", "", names(s))
names(s)
## [1] "ac" "ae" "cc" "ce" "ch" "cn" "cr" "ec" "ev" "fi" "gg" "gh" "hg" "ic" "in"
## [16] "ip" "me" "mi" "ml" "mp" "mr" "uk"
var_names <- c("bio5", "bio13", "bio15")
study_area_parana <- geodata::gadm(country = "Brazil", path = "input_data/") %>%
sf::st_as_sf() %>%
dplyr::filter(NAME_1 == "Paraná")
study_area_parana
## Simple feature collection with 1 feature and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -54.61602 ymin: -26.71712 xmax: -48.02354 ymax: -22.5163
## Geodetic CRS: WGS 84
## GID_1 GID_0 COUNTRY NAME_1 VARNAME_1 NL_NAME_1 TYPE_1 ENGTYPE_1 CC_1
## 1 BRA.16_1 BRA Brazil Paraná <NA> <NA> Estado State <NA>
## HASC_1 ISO_1 geometry
## 1 BR.PR <NA> MULTIPOLYGON (((-52.52423 -...
plot(study_area_parana$geometry)
tictoc::tic()
res10 <- chooseGCM::compare_gcms(s, var_names, study_area_parana, k = 3)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the factoextra package.
## Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
tictoc::toc()
## 22.568 sec elapsed
res10$statistics_gcms
tictoc::tic()
s_sum <- chooseGCM::summary_gcms(s, var_names, study_area_parana)
tictoc::toc()
## 1.019 sec elapsed
s_sum
## $ac
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 30.0 33.10 35.0 34.85827 36.60 38.9 2.07434 0
## bio13 219.9 281.45 312.5 322.35955 367.15 447.1 49.94167 0
## bio15 21.1 31.35 36.0 35.79873 40.00 52.8 6.70125 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ae
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.5 31.7 33.9 33.77850 35.80 39.0 2.456584 0
## bio13 160.8 205.0 234.9 232.03409 253.85 346.4 33.989464 0
## bio15 13.6 23.0 27.0 27.87256 32.40 49.9 7.274955 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $cc
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 32.6 37.00 40.5 40.15403 43.2 46.2 3.572336 0
## bio13 120.6 162.95 174.8 179.43027 190.9 259.9 22.875207 0
## bio15 25.7 35.80 41.3 41.72546 46.8 64.0 8.123692 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ce
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.3 31.00 33.4 33.13451 35.20 37.6 2.402536 0
## bio13 154.9 188.40 207.8 210.41867 228.45 352.4 30.141739 0
## bio15 22.0 30.05 34.4 35.71697 39.70 61.8 7.875488 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ch
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 30.1 32.80 35.0 34.77143 36.80 38.2 2.234700 0
## bio13 157.6 197.75 227.8 234.44653 265.45 349.1 42.821337 0
## bio15 21.1 29.45 34.1 34.04272 37.60 50.8 6.026132 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $cn
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.6 32.30 34.2 34.04342 35.85 37.8 2.027760 0
## bio13 161.4 201.60 231.4 242.91598 284.05 365.6 50.212614 0
## bio15 21.6 29.05 33.7 33.76478 37.75 50.2 5.928112 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $cr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.5 32.20 33.9 33.75672 35.40 37.4 1.883030 0
## bio13 153.0 196.95 224.1 228.96860 258.75 324.9 38.515889 0
## bio15 17.8 27.20 32.8 33.03182 37.90 52.0 7.391182 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ec
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.9 30.65 33.4 33.68529 36.50 40.5 3.351218 0
## bio13 150.3 191.25 220.2 223.01669 250.35 346.0 38.295019 0
## bio15 23.3 29.90 32.9 33.70778 37.40 48.7 5.044691 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ev
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.1 30.90 34.0 34.13607 37.1 40.9 3.461977 0
## bio13 145.4 179.20 201.9 208.62999 232.9 360.9 37.832441 0
## bio15 24.0 30.35 33.9 34.69505 37.9 52.0 5.371725 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $fi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.8 31.90 33.9 33.70438 35.5 38.4 2.114759 0
## bio13 159.8 201.85 219.9 225.56775 250.0 337.8 31.601529 0
## bio15 17.7 25.55 29.6 30.53762 34.1 52.2 6.643050 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $gg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.2 30.80 32.9 32.66662 34.5 36.6 2.085486 0
## bio13 142.0 176.30 197.1 196.48373 213.4 318.6 24.400397 0
## bio15 11.2 18.75 22.5 23.91513 27.7 46.7 7.179333 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $gh
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 30.7 32.7 32.65842 34.6 36.5 2.202657 0
## bio13 143.7 181.3 208.1 209.30170 237.4 298.2 31.733054 0
## bio15 19.1 25.6 28.1 29.45078 32.8 50.2 5.974342 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $hg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 30.9 34.5 36.7 36.54314 38.7 41.1 2.421853 0
## bio13 167.8 210.9 235.3 244.25516 275.6 379.1 41.680786 0
## bio15 15.1 22.9 26.9 28.00778 31.9 48.7 6.588587 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ic
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.3 30.7 32.5 32.41697 34.00 36.4 1.903841 0
## bio13 137.3 170.3 186.2 193.20354 213.95 298.1 28.884706 0
## bio15 14.2 23.7 27.7 28.84356 33.10 51.6 7.329611 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $`in`
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.4 30.8 32.5 32.48020 34.00 37.0 1.914905 0
## bio13 144.7 184.6 199.9 202.81683 214.10 373.5 25.602512 0
## bio15 13.6 23.5 28.0 28.85955 33.75 53.0 8.055430 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ip
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.5 32.75 35.8 35.52984 38.00 40.7 3.006113 0
## bio13 146.1 181.20 194.6 197.28487 211.15 303.5 21.504443 0
## bio15 15.5 26.30 32.8 33.45799 39.50 61.9 9.749642 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $me
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.3 29.60 31.4 31.34767 32.9 35.3 1.921691 0
## bio13 146.2 178.95 199.9 204.60934 226.6 316.6 30.162977 0
## bio15 15.0 25.90 28.8 29.88161 33.7 51.1 6.903009 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $mi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.4 32.0 33.1 33.08105 34.20 37.0 1.511685 0
## bio13 156.9 190.6 209.1 215.29208 239.75 324.6 30.811766 0
## bio15 16.5 25.9 29.3 29.73678 33.40 45.1 5.746360 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $ml
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.1 30.50 32.3 32.26351 33.95 36.9 1.985585 0
## bio13 141.3 173.20 188.6 190.05262 202.90 339.6 24.682023 0
## bio15 18.0 28.45 33.0 34.31146 39.80 58.6 8.766429 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $mp
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 30.30 32.0 32.00636 33.70 36.0 1.957350 0
## bio13 150.3 189.10 208.4 210.16040 228.40 307.4 28.147191 0
## bio15 15.0 25.35 29.4 30.95092 35.95 54.1 8.208039 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $mr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.9 30.4 32.1 31.95361 33.50 36.2 1.845843 0
## bio13 167.5 210.4 243.4 244.34851 275.65 330.1 38.164065 0
## bio15 17.9 26.3 32.3 32.14031 37.05 50.9 7.377425 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
##
## $uk
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 31.0 34.1 36.3 36.28939 38.4 41.5 2.521306 0
## bio13 154.9 198.9 228.4 234.23621 267.7 379.0 44.530524 0
## bio15 17.2 25.7 30.4 30.83777 35.3 49.4 6.706006 0
## n_cells
## bio5 707
## bio13 707
## bio15 707
tictoc::tic()
s_cor <- chooseGCM::cor_gcms(s, var_names, study_area_parana, method = "pearson")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
tictoc::toc()
## 0.988 sec elapsed
s_cor
## $cor_matrix
## ac ae cc ce ch cn cr
## ac 1.0000000 0.8221623 0.7779686 0.7169188 0.9268902 0.9706512 0.9692144
## ae 0.8221623 1.0000000 0.8690880 0.9059237 0.8964003 0.8660950 0.8842169
## cc 0.7779686 0.8690880 1.0000000 0.8749034 0.8142541 0.7982917 0.8337845
## ce 0.7169188 0.9059237 0.8749034 1.0000000 0.8315531 0.7650128 0.7983690
## ch 0.9268902 0.8964003 0.8142541 0.8315531 1.0000000 0.9491279 0.9630421
## cn 0.9706512 0.8660950 0.7982917 0.7650128 0.9491279 1.0000000 0.9822694
## cr 0.9692144 0.8842169 0.8337845 0.7983690 0.9630421 0.9822694 1.0000000
## ec 0.8349417 0.9136489 0.7905206 0.8093051 0.9017900 0.8806604 0.8778921
## ev 0.8170684 0.9060546 0.8150262 0.8426813 0.9035868 0.8794336 0.8723896
## fi 0.8568288 0.9221515 0.8636071 0.9040518 0.9075295 0.8967866 0.9097130
## gg 0.8361614 0.9446461 0.8706672 0.9267101 0.8968419 0.8727489 0.9079228
## gh 0.9095253 0.8322720 0.7753705 0.7362790 0.8830002 0.9155257 0.9210175
## hg 0.8802669 0.9315131 0.8199187 0.8325131 0.9111676 0.9103634 0.9139112
## ic 0.9055991 0.9191887 0.8768717 0.8760769 0.9475743 0.9284401 0.9549257
## in 0.7283280 0.8899324 0.8719957 0.9011391 0.8107158 0.7694313 0.8103198
## ip 0.6781061 0.8952220 0.9234523 0.9032355 0.7509823 0.7044157 0.7561158
## me 0.8923429 0.9314834 0.8655184 0.8742634 0.9340380 0.9206270 0.9461317
## mi 0.9337817 0.8932794 0.8243319 0.8122928 0.9402338 0.9420059 0.9673063
## ml 0.7751363 0.9281638 0.8754045 0.9372642 0.8478131 0.8124633 0.8520258
## mp 0.7946159 0.9472760 0.8701070 0.9365527 0.8620874 0.8304357 0.8569165
## mr 0.9796740 0.7846757 0.7578737 0.6833181 0.9117286 0.9533497 0.9638900
## uk 0.8667022 0.9426605 0.8387373 0.8451482 0.9186445 0.9030544 0.9120982
## ec ev fi gg gh hg ic
## ac 0.8349417 0.8170684 0.8568288 0.8361614 0.9095253 0.8802669 0.9055991
## ae 0.9136489 0.9060546 0.9221515 0.9446461 0.8322720 0.9315131 0.9191887
## cc 0.7905206 0.8150262 0.8636071 0.8706672 0.7753705 0.8199187 0.8768717
## ce 0.8093051 0.8426813 0.9040518 0.9267101 0.7362790 0.8325131 0.8760769
## ch 0.9017900 0.9035868 0.9075295 0.8968419 0.8830002 0.9111676 0.9475743
## cn 0.8806604 0.8794336 0.8967866 0.8727489 0.9155257 0.9103634 0.9284401
## cr 0.8778921 0.8723896 0.9097130 0.9079228 0.9210175 0.9139112 0.9549257
## ec 1.0000000 0.9768839 0.8874581 0.8586740 0.8349162 0.9386699 0.8496625
## ev 0.9768839 1.0000000 0.9065067 0.8724732 0.8186457 0.9421069 0.8635192
## fi 0.8874581 0.9065067 1.0000000 0.9519501 0.8771491 0.9532972 0.9296169
## gg 0.8586740 0.8724732 0.9519501 1.0000000 0.8811278 0.9099681 0.9460605
## gh 0.8349162 0.8186457 0.8771491 0.8811278 1.0000000 0.8725502 0.8701500
## hg 0.9386699 0.9421069 0.9532972 0.9099681 0.8725502 1.0000000 0.9064677
## ic 0.8496625 0.8635192 0.9296169 0.9460605 0.8701500 0.9064677 1.0000000
## in 0.7582028 0.7879370 0.8827371 0.9286185 0.7322632 0.8308887 0.8999875
## ip 0.7624028 0.7807836 0.8327634 0.8885051 0.7185161 0.7902233 0.8306863
## me 0.8537084 0.8612248 0.9276555 0.9556698 0.8783703 0.9112265 0.9893202
## mi 0.8620506 0.8606672 0.9137509 0.9210249 0.8792560 0.9173857 0.9658573
## ml 0.8139954 0.8416309 0.9292728 0.9661893 0.8058758 0.8796517 0.9150769
## mp 0.8335828 0.8505111 0.9424856 0.9472100 0.8181699 0.8959109 0.9151773
## mr 0.8059343 0.7899833 0.8413499 0.8243118 0.9300504 0.8537551 0.8889867
## uk 0.9517633 0.9588460 0.9359616 0.9042762 0.8422931 0.9848134 0.9161233
## in ip me mi ml mp mr
## ac 0.7283280 0.6781061 0.8923429 0.9337817 0.7751363 0.7946159 0.9796740
## ae 0.8899324 0.8952220 0.9314834 0.8932794 0.9281638 0.9472760 0.7846757
## cc 0.8719957 0.9234523 0.8655184 0.8243319 0.8754045 0.8701070 0.7578737
## ce 0.9011391 0.9032355 0.8742634 0.8122928 0.9372642 0.9365527 0.6833181
## ch 0.8107158 0.7509823 0.9340380 0.9402338 0.8478131 0.8620874 0.9117286
## cn 0.7694313 0.7044157 0.9206270 0.9420059 0.8124633 0.8304357 0.9533497
## cr 0.8103198 0.7561158 0.9461317 0.9673063 0.8520258 0.8569165 0.9638900
## ec 0.7582028 0.7624028 0.8537084 0.8620506 0.8139954 0.8335828 0.8059343
## ev 0.7879370 0.7807836 0.8612248 0.8606672 0.8416309 0.8505111 0.7899833
## fi 0.8827371 0.8327634 0.9276555 0.9137509 0.9292728 0.9424856 0.8413499
## gg 0.9286185 0.8885051 0.9556698 0.9210249 0.9661893 0.9472100 0.8243118
## gh 0.7322632 0.7185161 0.8783703 0.8792560 0.8058758 0.8181699 0.9300504
## hg 0.8308887 0.7902233 0.9112265 0.9173857 0.8796517 0.8959109 0.8537551
## ic 0.8999875 0.8306863 0.9893202 0.9658573 0.9150769 0.9151773 0.8889867
## in 1.0000000 0.9024846 0.9086404 0.8680603 0.9544819 0.9068467 0.7100872
## ip 0.9024846 1.0000000 0.8357375 0.7723642 0.9179682 0.8997399 0.6640410
## me 0.9086404 0.8357375 1.0000000 0.9650137 0.9274084 0.9222020 0.8709459
## mi 0.8680603 0.7723642 0.9650137 1.0000000 0.8871580 0.8759934 0.9204307
## ml 0.9544819 0.9179682 0.9274084 0.8871580 1.0000000 0.9692117 0.7607951
## mp 0.9068467 0.8997399 0.9222020 0.8759934 0.9692117 1.0000000 0.7700381
## mr 0.7100872 0.6640410 0.8709459 0.9204307 0.7607951 0.7700381 1.0000000
## uk 0.8347216 0.8076055 0.9201462 0.9171602 0.8817252 0.8962239 0.8356316
## uk
## ac 0.8667022
## ae 0.9426605
## cc 0.8387373
## ce 0.8451482
## ch 0.9186445
## cn 0.9030544
## cr 0.9120982
## ec 0.9517633
## ev 0.9588460
## fi 0.9359616
## gg 0.9042762
## gh 0.8422931
## hg 0.9848134
## ic 0.9161233
## in 0.8347216
## ip 0.8076055
## me 0.9201462
## mi 0.9171602
## ml 0.8817252
## mp 0.8962239
## mr 0.8356316
## uk 1.0000000
##
## $cor_plot
tictoc::tic()
s_dist <- chooseGCM::dist_gcms(s, var_names, study_area_parana, method = "euclidean")
tictoc::toc()
## 0.933 sec elapsed
s_dist
## $distances
## ac ae cc ce ch cn cr
## ae 27.446681
## cc 30.667980 23.548745
## ce 34.628484 19.962645 23.019761
## ch 17.598104 20.948707 28.050305 26.712186
## cn 11.149951 23.816414 29.230741 31.550051 14.679723
## cr 11.419615 22.146265 26.534672 29.225141 12.512146 8.666425
## ec 26.442146 19.125466 29.788501 28.421533 20.396504 22.483828 22.743114
## ev 27.836995 19.948749 27.991945 25.814760 20.209062 22.599099 23.249899
## fi 24.626673 18.159462 24.036645 20.160271 19.791534 20.909617 19.556480
## gg 26.344267 15.312714 23.406276 17.619761 20.904009 23.217139 19.749404
## gh 19.576790 26.655126 30.846886 33.423379 22.262322 18.916481 18.291254
## hg 22.520868 17.032625 27.619274 26.635960 19.398296 19.485910 19.096395
## ic 19.997050 18.501802 22.837944 22.911527 14.902189 17.410565 13.817914
## in 33.923480 21.592735 23.285747 20.463989 28.316214 31.252023 28.345818
## ip 36.926176 21.067497 18.007113 20.245846 32.478287 35.384956 32.141774
## me 21.354983 17.036328 23.867637 23.078569 16.715711 18.336408 15.105834
## mi 16.748160 21.261901 27.278746 28.198007 15.911306 15.673647 11.768199
## ml 30.862963 17.444144 22.973607 16.301801 25.390231 28.185201 25.036346
## mp 29.495883 14.944524 23.456912 16.393990 24.170187 26.800642 24.619135
## mr 9.279065 30.201222 32.025727 36.626010 19.336955 14.057400 12.367787
## uk 23.762350 15.584933 26.136351 25.611562 18.563994 20.264791 19.296427
## ec ev fi gg gh hg ic
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev 9.895444
## fi 21.834094 19.900690
## gg 24.467468 23.242281 14.266717
## gh 26.444187 27.716722 22.812199 22.439752
## hg 16.118141 15.659990 14.065311 19.528833 23.235264
## ic 25.235483 24.044388 17.266817 15.115804 23.453032 19.904844
## in 32.003952 29.971632 22.287339 17.388854 33.676893 26.764818 20.582831
## ip 31.724781 30.472949 26.616049 21.732288 34.530650 29.809629 26.780826
## me 24.893601 24.245652 17.505754 13.703384 22.698531 19.391866 6.726042
## mi 24.173410 24.294316 19.114162 18.290392 22.615738 18.707058 12.026155
## ml 28.069834 25.900799 17.308966 11.967548 28.675952 22.578652 18.966658
## mp 26.550767 25.164163 15.608686 14.953883 27.753063 20.998126 18.955446
## mr 28.671630 29.826681 25.923768 27.280310 17.213552 24.889621 21.685301
## uk 14.294423 13.203345 16.470173 20.136688 25.846591 8.020631 18.849452
## in ip me mi ml mp mr
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi
## gg
## gh
## hg
## ic
## in
## ip 20.324249
## me 19.672293 26.378324
## mi 23.640991 31.052624 12.173819
## ml 13.885772 18.640998 17.535623 21.863181
## mp 19.864473 20.608296 18.153574 22.919246 11.420123
## mr 35.043838 37.724291 23.381047 18.359078 31.831936 31.210876
## uk 26.459766 28.547906 18.391860 18.732579 22.383299 20.966532 26.386822
##
## $heatmap
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3, method = "euclidean")
## $suggested_gcms
## 1 2 3
## "ml" "uk" "cr"
##
## $kmeans_plot
tictoc::toc()
## 1.886 sec elapsed
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "mp" "gh" "ip"
##
## $kmeans_plot
tictoc::toc()
## 1.65 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "me" "fi" "hg"
##
## $dend_plot
tictoc::toc()
## 1.28 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3, n = 1000)
## $suggested_gcms
## [1] "me" "hg" "fi"
##
## $dend_plot
tictoc::toc()
## 1.273 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "gh" "me" "uk"
##
## $best_mean_diff
## [1] 2.547513e-05
##
## $global_mean
## [1] 22.31235
tictoc::toc()
## 1.015 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana)
## $suggested_gcms
## [1] "gh" "me" "uk"
##
## $best_mean_diff
## [1] 2.547513e-05
##
## $global_mean
## [1] 22.31235
tictoc::toc()
## 1.152 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "wss", n = 1000)
tictoc::toc()
## 1.371 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "silhouette", n = 1000)
tictoc::toc()
## 1.24 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "gap_stat", n = 1000)
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
tictoc::toc()
## 43.193 sec elapsed
tictoc::tic()
chooseGCM::montecarlo_gcms(s, var_names, study_area_parana, perm = 10000, method = "euclidean")
## $montecarlo_plot
##
## $suggested_gcms
## $suggested_gcms$k2
## [1] "fi" "in"
##
## $suggested_gcms$k3
## [1] "gh" "me" "uk"
##
## $suggested_gcms$k4
## [1] "ce" "mi" "fi" "in"
##
## $suggested_gcms$k5
## [1] "ce" "ev" "gg" "in" "hg"
##
## $suggested_gcms$k6
## [1] "ec" "fi" "ml" "cr" "ac" "ev"
##
## $suggested_gcms$k7
## [1] "gg" "ic" "ec" "ce" "in" "ch" "ev"
##
## $suggested_gcms$k8
## [1] "ae" "ch" "ce" "ev" "mi" "cn" "ac" "mr"
##
## $suggested_gcms$k9
## [1] "ce" "mi" "fi" "in" "cr" "cn" "mr" "uk" "ml"
##
## $suggested_gcms$k10
## [1] "ce" "ch" "fi" "cn" "ev" "ml" "ec" "mi" "ac" "mp"
##
## $suggested_gcms$k11
## [1] "ae" "ic" "ip" "cr" "in" "ch" "hg" "ev" "cn" "ec" "ml"
##
## $suggested_gcms$k12
## [1] "ce" "me" "uk" "in" "ch" "ev" "ec" "cn" "ml" "mp" "cr" "ac"
##
## $suggested_gcms$k13
## [1] "fi" "me" "mr" "ml" "in" "uk" "cn" "ac" "mp" "gh" "ae" "ch" "ev"
##
## $suggested_gcms$k14
## [1] "ac" "ae" "mr" "uk" "ev" "gg" "mp" "ml" "ec" "cn" "gh" "mi" "ce" "hg"
##
## $suggested_gcms$k15
## [1] "ic" "me" "ip" "cn" "in" "uk" "ch" "ac" "mp" "ml" "ce" "hg" "ev" "cr" "ec"
##
## $suggested_gcms$k16
## [1] "cr" "ec" "gg" "gh" "mr" "ev" "ae" "mp" "ac" "fi" "ml" "ce" "ic" "cn" "in"
## [16] "ch"
##
## $suggested_gcms$k17
## [1] "ae" "ec" "ce" "ic" "cr" "ml" "in" "ev" "cn" "mp" "cc" "uk" "ch" "ac" "mi"
## [16] "mr" "fi"
##
## $suggested_gcms$k18
## [1] "gh" "ml" "mp" "ce" "in" "ip" "ic" "mi" "cr" "ae" "hg" "cn" "ch" "ac" "uk"
## [16] "ev" "fi" "ec"
##
## $suggested_gcms$k19
## [1] "ac" "ev" "mr" "ic" "ec" "fi" "gh" "gg" "ae" "mp" "ml" "cn" "ce" "ch" "uk"
## [16] "in" "mi" "cc" "cr"
##
## $suggested_gcms$k20
## [1] "cc" "fi" "ce" "in" "ip" "me" "mi" "uk" "hg" "cr" "ch" "ev" "cn" "mp" "ec"
## [16] "ml" "ac" "ae" "gh" "ic"
##
## $suggested_gcms$k21
## [1] "ae" "cc" "ce" "uk" "ip" "in" "hg" "ic" "mi" "cr" "ch" "ev" "cn" "mp" "ec"
## [16] "ml" "ac" "fi" "mr" "me" "gh"
tictoc::toc()
## 18.253 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = res10$suggested_gcms$k3)
tictoc::toc()
## 1.819 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = "sum")
tictoc::toc()
## 1.879 sec elapsed
tictoc::tic()
s <- chooseGCM::import_gcms(path = "~/storage/WC_data/WC_data_all_gcms_5")
tictoc::toc()
## 0.516 sec elapsed
s
## $ac_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ac_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -2.6, -130.4, 7.5, -24.8, -65.4, ...
## max values : 38.3, 22.0, 94.3, 2252.1, 56.5, 30.6, ...
##
## $ae_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ae_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.5, -1.0, -10.5, 11.7, -25.2, -67.5, ...
## max values : 37.0, 21.9, 94.4, 2237.6, 55.7, 29.1, ...
##
## $cc_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cc_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -45.1, -2, -33.0, 13.4, -23.8, -65.0, ...
## max values : 39.8, 22, 95.1, 2231.1, 58.6, 32.4, ...
##
## $ce_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ce_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.3, -3.0, -38.2, 12.4, -25.4, -67.5, ...
## max values : 37.3, 22.8, 95.4, 2289.3, 55.6, 29.3, ...
##
## $ch_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ch_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -2.6, -54.6, 13.6, -23.3, -67.6, ...
## max values : 37.8, 22.6, 94.3, 2258.2, 58.6, 29.7, ...
##
## $cn_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cn_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -3.2, -64.1, 13.7, -23.8, -66.6, ...
## max values : 37.8, 22.9, 95.4, 2168.6, 56.9, 29.7, ...
##
## $cr_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cr_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.7, -39.6, 8.9, -24.3, -67.8, ...
## max values : 37.4, 22.9, 95.7, 2188.3, 56.0, 29.6, ...
##
## $ec_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ec_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -2.7, -26.6, 11.1, -26.0, -68.5, ...
## max values : 38.0, 21.9, 95.9, 2365.1, 55.8, 30.2, ...
##
## $ev_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ev_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49, -2.6, -16.1, 10.5, -26.2, -67.1, ...
## max values : 38, 21.8, 96.3, 2361.9, 55.6, 29.9, ...
##
## $fi_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : fi_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.4, -2.2, -30.0, 10.5, -24.6, -66.7, ...
## max values : 37.0, 21.9, 94.3, 2191.5, 55.0, 29.0, ...
##
## $gg_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gg_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.1, -0.4, -3.2, 7.8, -25.3, -66.2, ...
## max values : 36.9, 22.0, 96.5, 2274.6, 55.0, 28.7, ...
##
## $gh_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gh_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -0.3, -2.4, 6.6, -25.6, -65.9, ...
## max values : 37.2, 22.8, 95.8, 2261.7, 55.6, 28.9, ...
##
## $hg_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : hg_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -2.7, -80.7, 10.1, -24.9, -66.6, ...
## max values : 38.6, 21.4, 95.3, 2296.9, 57.0, 31.6, ...
##
## $ic_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ic_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.0, -2.5, -21.7, 9.0, -25.6, -69.1, ...
## max values : 35.4, 22.6, 95.2, 2328.5, 52.7, 27.8, ...
##
## $in_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : in_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.5, -1.8, -23.3, 6.8, -25.4, -67.2, ...
## max values : 35.7, 23.2, 95.0, 2345.6, 53.5, 28.7, ...
##
## $ip_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ip_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.3, -20.3, 8.0, -25.8, -65.5, ...
## max values : 38.0, 21.7, 95.1, 2195.9, 56.5, 29.8, ...
##
## $me_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : me_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.7, -1.0, -8.2, 9.2, -28.1, -69.2, ...
## max values : 36.4, 23.1, 94.6, 2242.0, 54.7, 28.2, ...
##
## $mi_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mi_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.4, -1.9, -11.0, 10.6, -26.9, -68.4, ...
## max values : 36.4, 23.1, 95.5, 2258.9, 55.2, 27.9, ...
##
## $ml_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ml_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.3, -0.7, -4.6, 10.5, -26.5, -68.8, ...
## max values : 35.4, 21.7, 95.7, 2254.0, 54.3, 28.1, ...
##
## $mp_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mp_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.8, -0.5, -3.2, 13.7, -26.3, -67.1, ...
## max values : 35.2, 21.6, 96.1, 2286.9, 53.7, 28.1, ...
##
## $mr_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mr_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.7, -1.6, -20.6, 8.3, -24.6, -68.3, ...
## max values : 36.6, 22.6, 94.6, 2157.6, 55.2, 28.5, ...
##
## $uk_ssp585_5_2090
## class : SpatRaster
## dimensions : 2160, 4320, 19 (nrow, ncol, nlyr)
## resolution : 0.08333333, 0.08333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : uk_ssp585_5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.6, -3.5, -71.4, 8.8, -24.1, -66.6, ...
## max values : 38.9, 21.5, 95.1, 2326.5, 57.5, 31.2, ...
names(s)
## [1] "ac_ssp585_5_2090" "ae_ssp585_5_2090" "cc_ssp585_5_2090" "ce_ssp585_5_2090"
## [5] "ch_ssp585_5_2090" "cn_ssp585_5_2090" "cr_ssp585_5_2090" "ec_ssp585_5_2090"
## [9] "ev_ssp585_5_2090" "fi_ssp585_5_2090" "gg_ssp585_5_2090" "gh_ssp585_5_2090"
## [13] "hg_ssp585_5_2090" "ic_ssp585_5_2090" "in_ssp585_5_2090" "ip_ssp585_5_2090"
## [17] "me_ssp585_5_2090" "mi_ssp585_5_2090" "ml_ssp585_5_2090" "mp_ssp585_5_2090"
## [21] "mr_ssp585_5_2090" "uk_ssp585_5_2090"
names(s) <- gsub("_ssp585_5_2090", "", names(s))
names(s)
## [1] "ac" "ae" "cc" "ce" "ch" "cn" "cr" "ec" "ev" "fi" "gg" "gh" "hg" "ic" "in"
## [16] "ip" "me" "mi" "ml" "mp" "mr" "uk"
var_names <- c("bio5", "bio13", "bio15")
study_area_parana <- geodata::gadm(country = "Brazil", path = "input_data/") %>%
sf::st_as_sf() %>%
dplyr::filter(NAME_1 == "Paraná")
study_area_parana
## Simple feature collection with 1 feature and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -54.61602 ymin: -26.71712 xmax: -48.02354 ymax: -22.5163
## Geodetic CRS: WGS 84
## GID_1 GID_0 COUNTRY NAME_1 VARNAME_1 NL_NAME_1 TYPE_1 ENGTYPE_1 CC_1
## 1 BRA.16_1 BRA Brazil Paraná <NA> <NA> Estado State <NA>
## HASC_1 ISO_1 geometry
## 1 BR.PR <NA> MULTIPOLYGON (((-52.52423 -...
plot(study_area_parana$geometry)
tictoc::tic()
res5 <- chooseGCM::compare_gcms(s, var_names, study_area_parana, k = 3)
tictoc::toc()
## 26.812 sec elapsed
res5$statistics_gcms
tictoc::tic()
s_sum <- chooseGCM::summary_gcms(s, var_names, study_area_parana)
tictoc::toc()
## 2.083 sec elapsed
s_sum
## $ac
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.4 33.1 35 34.82698 36.5 39.0 2.073704 0
## bio13 219.0 282.5 314 323.65810 368.5 451.5 50.172973 0
## bio15 20.6 31.5 36 35.80107 40.0 53.5 6.485186 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ae
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.9 31.7 33.8 33.73835 35.7 39.0 2.431370 0
## bio13 160.8 205.3 235.5 232.75633 254.8 374.8 35.017405 0
## bio15 13.8 23.1 27.0 27.81838 32.3 50.0 7.036772 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $cc
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 30.9 36.9 40.4 40.11812 43.2 46.3 3.545503 0
## bio13 115.5 163.0 175.3 180.03632 192.0 275.5 23.445537 0
## bio15 24.8 36.0 41.5 41.70971 46.9 64.1 7.909567 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ce
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.7 31.0 33.3 33.10181 35.1 37.7 2.388513 0
## bio13 154.3 188.3 207.5 210.95426 228.0 363.5 31.567165 0
## bio15 21.5 30.3 34.5 35.66231 39.7 62.1 7.570596 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ch
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.4 32.8 35 34.74396 36.7 38.3 2.238552 0
## bio13 157.5 198.0 228 234.88870 265.0 362.0 43.158342 0
## bio15 20.9 29.5 34 33.99712 37.5 51.2 5.821909 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $cn
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.1 32.3 34.2 34.01347 35.8 37.9 2.028597 0
## bio13 159.5 201.8 232.0 243.74581 284.3 369.0 50.317043 0
## bio15 21.4 29.1 33.6 33.69815 37.6 50.8 5.747389 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $cr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 32.1 33.9 33.72842 35.4 37.5 1.885993 0
## bio13 150.0 197.5 225.0 229.80568 259.0 348.0 38.730246 0
## bio15 17.3 27.3 32.9 32.99155 37.9 52.6 7.171921 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ec
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.5 30.6 33.3 33.64688 36.5 40.5 3.324038 0
## bio13 150.0 190.5 221.3 223.40609 251.0 360.3 38.600105 0
## bio15 22.8 30.0 32.9 33.63994 37.2 48.8 4.860260 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ev
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.7 31.0 34.0 34.09690 37.0 41.0 3.432284 0
## bio13 143.3 179.5 202.3 208.94352 232.0 393.8 38.275202 0
## bio15 24.2 30.4 34.0 34.58143 37.9 52.3 5.166289 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $fi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.1 31.9 33.9 33.67250 35.4 38.5 2.108177 0
## bio13 153.3 201.0 220.3 226.20609 250.3 369.3 32.353017 0
## bio15 17.8 25.7 29.6 30.48616 33.9 52.4 6.421426 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $gg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.6 30.9 32.8 32.63920 34.4 36.7 2.085860 0
## bio13 136.8 176.5 197.3 197.16180 213.5 348.3 25.485761 0
## bio15 11.3 18.8 22.5 23.86737 27.8 47.1 6.944005 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $gh
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.5 30.7 32.8 32.62798 34.5 36.6 2.199624 0
## bio13 141.3 181.3 208.8 209.91528 237.8 306.3 31.802287 0
## bio15 19.1 25.6 28.1 29.40742 32.7 50.9 5.750448 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $hg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.2 34.5 36.7 36.50310 38.6 41.2 2.397355 0
## bio13 167.0 211.3 237.3 245.02920 277.5 395.3 42.286091 0
## bio15 14.8 23.0 27.0 27.94625 31.8 49.0 6.366479 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ic
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.0 30.8 32.5 32.38597 33.9 36.5 1.903756 0
## bio13 134.5 170.8 187.0 193.93108 214.0 324.5 29.788108 0
## bio15 14.3 24.0 27.8 28.81639 33.2 52.2 7.106840 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $`in`
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.4 30.8 32.5 32.44921 34.0 37.1 1.916697 0
## bio13 140.3 184.8 199.8 203.58498 215.0 402.8 27.624952 0
## bio15 13.8 23.5 27.9 28.82750 33.3 53.3 7.870385 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ip
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 32.8 35.8 35.49679 38.0 40.8 2.984111 0
## bio13 139.8 180.8 195.0 197.76604 211.5 324.8 22.457526 0
## bio15 15.2 26.4 32.7 33.38376 39.5 62.3 9.483548 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $me
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.3 29.6 31.4 31.31436 32.9 35.4 1.926233 0
## bio13 143.8 179.3 201.0 205.34932 227.3 348.3 30.846710 0
## bio15 15.2 25.9 28.8 29.84736 33.7 51.5 6.682520 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $mi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.9 32.0 33.1 33.05489 34.2 37.0 1.514363 0
## bio13 154.0 191.5 210.0 216.29487 240.3 358.8 31.408972 0
## bio15 16.6 26.0 29.2 29.70520 33.3 45.5 5.575833 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $ml
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.9 30.5 32.3 32.22743 33.8 37.0 1.981039 0
## bio13 134.5 173.0 188.8 190.58594 203.3 371.5 25.946013 0
## bio15 17.8 28.5 33.0 34.22503 39.7 58.8 8.533996 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $mp
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.7 30.3 32.0 31.97350 33.6 36.2 1.952722 0
## bio13 146.5 189.5 207.8 210.64880 229.5 320.0 29.001875 0
## bio15 14.8 25.4 29.4 30.88424 35.8 54.2 7.965020 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $mr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.4 30.4 32.1 31.92614 33.5 36.3 1.844875 0
## bio13 165.8 211.5 244.0 245.28224 276.0 337.8 38.182205 0
## bio15 18.1 26.6 32.2 32.11473 37.1 51.0 7.143655 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
##
## $uk
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.3 34.1 36.3 36.24732 38.3 41.6 2.496220 0
## bio13 154.3 199.8 229.5 235.09598 267.3 414.3 45.107537 0
## bio15 16.9 25.9 30.4 30.77818 35.2 49.9 6.522233 0
## n_cells
## bio5 2709
## bio13 2709
## bio15 2709
tictoc::tic()
s_cor <- chooseGCM::cor_gcms(s, var_names, study_area_parana, method = "pearson")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
tictoc::toc()
## 1.921 sec elapsed
s_cor
## $cor_matrix
## ac ae cc ce ch cn cr
## ac 1.0000000 0.8173858 0.7711748 0.7179765 0.9241295 0.9705710 0.9671179
## ae 0.8173858 1.0000000 0.8715875 0.9123062 0.8969533 0.8632907 0.8854278
## cc 0.7711748 0.8715875 1.0000000 0.8804813 0.8142440 0.7950763 0.8331667
## ce 0.7179765 0.9123062 0.8804813 1.0000000 0.8394004 0.7692657 0.8059461
## ch 0.9241295 0.8969533 0.8142440 0.8394004 1.0000000 0.9463690 0.9619148
## cn 0.9705710 0.8632907 0.7950763 0.7692657 0.9463690 1.0000000 0.9815911
## cr 0.9671179 0.8854278 0.8331667 0.8059461 0.9619148 0.9815911 1.0000000
## ec 0.8319650 0.9146100 0.7929487 0.8158945 0.9002500 0.8742605 0.8760772
## ev 0.8138890 0.9081171 0.8187434 0.8501454 0.9021403 0.8734238 0.8711197
## fi 0.8529429 0.9237787 0.8635436 0.9092070 0.9082206 0.8946379 0.9101398
## gg 0.8289659 0.9471959 0.8708400 0.9313204 0.8970865 0.8699171 0.9073812
## gh 0.9059004 0.8288497 0.7668125 0.7372022 0.8796565 0.9122240 0.9172521
## hg 0.8757270 0.9298170 0.8175125 0.8363702 0.9099776 0.9057336 0.9124010
## ic 0.8966414 0.9214896 0.8759833 0.8861039 0.9452912 0.9242818 0.9525070
## in 0.7192020 0.8914175 0.8699903 0.9068409 0.8113905 0.7665869 0.8114384
## ip 0.6745655 0.8998360 0.9271555 0.9070398 0.7551244 0.7050712 0.7604993
## me 0.8846945 0.9324686 0.8638381 0.8813768 0.9322724 0.9174094 0.9447358
## mi 0.9270438 0.8949387 0.8222088 0.8221603 0.9392844 0.9384781 0.9661098
## ml 0.7700158 0.9308827 0.8770235 0.9393946 0.8502091 0.8108059 0.8543918
## mp 0.7910133 0.9489404 0.8722258 0.9377844 0.8641827 0.8295766 0.8592487
## mr 0.9792693 0.7832829 0.7529892 0.6889213 0.9098066 0.9533102 0.9627692
## uk 0.8602460 0.9417723 0.8376696 0.8505000 0.9168584 0.8967935 0.9098599
## ec ev fi gg gh hg ic
## ac 0.8319650 0.8138890 0.8529429 0.8289659 0.9059004 0.8757270 0.8966414
## ae 0.9146100 0.9081171 0.9237787 0.9471959 0.8288497 0.9298170 0.9214896
## cc 0.7929487 0.8187434 0.8635436 0.8708400 0.7668125 0.8175125 0.8759833
## ce 0.8158945 0.8501454 0.9092070 0.9313204 0.7372022 0.8363702 0.8861039
## ch 0.9002500 0.9021403 0.9082206 0.8970865 0.8796565 0.9099776 0.9452912
## cn 0.8742605 0.8734238 0.8946379 0.8699171 0.9122240 0.9057336 0.9242818
## cr 0.8760772 0.8711197 0.9101398 0.9073812 0.9172521 0.9124010 0.9525070
## ec 1.0000000 0.9761416 0.8890413 0.8602106 0.8302732 0.9400636 0.8485564
## ev 0.9761416 1.0000000 0.9091332 0.8762555 0.8129800 0.9439963 0.8648921
## fi 0.8890413 0.9091332 1.0000000 0.9527748 0.8708108 0.9527199 0.9306857
## gg 0.8602106 0.8762555 0.9527748 1.0000000 0.8751100 0.9099832 0.9484557
## gh 0.8302732 0.8129800 0.8708108 0.8751100 1.0000000 0.8663494 0.8613727
## hg 0.9400636 0.9439963 0.9527199 0.9099832 0.8663494 1.0000000 0.9043321
## ic 0.8485564 0.8648921 0.9306857 0.9484557 0.8613727 0.9043321 1.0000000
## in 0.7613339 0.7940403 0.8844752 0.9324937 0.7258098 0.8302495 0.9072868
## ip 0.7691076 0.7883295 0.8358590 0.8920540 0.7158850 0.7916918 0.8373456
## me 0.8522000 0.8614007 0.9274862 0.9570192 0.8722983 0.9080845 0.9890249
## mi 0.8637353 0.8636340 0.9153467 0.9229647 0.8720729 0.9174975 0.9649228
## ml 0.8159719 0.8447415 0.9289325 0.9676883 0.8013216 0.8779044 0.9218777
## mp 0.8339581 0.8513427 0.9419276 0.9479838 0.8145484 0.8933668 0.9196561
## mr 0.8036785 0.7875380 0.8389952 0.8205802 0.9276598 0.8504369 0.8829857
## uk 0.9520154 0.9602204 0.9360604 0.9058653 0.8348261 0.9846209 0.9150244
## in ip me mi ml mp mr
## ac 0.7192020 0.6745655 0.8846945 0.9270438 0.7700158 0.7910133 0.9792693
## ae 0.8914175 0.8998360 0.9324686 0.8949387 0.9308827 0.9489404 0.7832829
## cc 0.8699903 0.9271555 0.8638381 0.8222088 0.8770235 0.8722258 0.7529892
## ce 0.9068409 0.9070398 0.8813768 0.8221603 0.9393946 0.9377844 0.6889213
## ch 0.8113905 0.7551244 0.9322724 0.9392844 0.8502091 0.8641827 0.9098066
## cn 0.7665869 0.7050712 0.9174094 0.9384781 0.8108059 0.8295766 0.9533102
## cr 0.8114384 0.7604993 0.9447358 0.9661098 0.8543918 0.8592487 0.9627692
## ec 0.7613339 0.7691076 0.8522000 0.8637353 0.8159719 0.8339581 0.8036785
## ev 0.7940403 0.7883295 0.8614007 0.8636340 0.8447415 0.8513427 0.7875380
## fi 0.8844752 0.8358590 0.9274862 0.9153467 0.9289325 0.9419276 0.8389952
## gg 0.9324937 0.8920540 0.9570192 0.9229647 0.9676883 0.9479838 0.8205802
## gh 0.7258098 0.7158850 0.8722983 0.8720729 0.8013216 0.8145484 0.9276598
## hg 0.8302495 0.7916918 0.9080845 0.9174975 0.8779044 0.8933668 0.8504369
## ic 0.9072868 0.8373456 0.9890249 0.9649228 0.9218777 0.9196561 0.8829857
## in 1.0000000 0.9030595 0.9123143 0.8713934 0.9581781 0.9093938 0.7073798
## ip 0.9030595 1.0000000 0.8411633 0.7770806 0.9201753 0.9019922 0.6638222
## me 0.9123143 0.8411633 1.0000000 0.9641333 0.9316329 0.9252043 0.8669400
## mi 0.8713934 0.7770806 0.9641333 1.0000000 0.8918453 0.8791435 0.9158909
## ml 0.9581781 0.9201753 0.9316329 0.8918453 1.0000000 0.9687037 0.7604284
## mp 0.9093938 0.9019922 0.9252043 0.8791435 0.9687037 1.0000000 0.7698315
## mr 0.7073798 0.6638222 0.8669400 0.9158909 0.7604284 0.7698315 1.0000000
## uk 0.8369389 0.8115851 0.9179043 0.9173505 0.8827355 0.8953015 0.8309562
## uk
## ac 0.8602460
## ae 0.9417723
## cc 0.8376696
## ce 0.8505000
## ch 0.9168584
## cn 0.8967935
## cr 0.9098599
## ec 0.9520154
## ev 0.9602204
## fi 0.9360604
## gg 0.9058653
## gh 0.8348261
## hg 0.9846209
## ic 0.9150244
## in 0.8369389
## ip 0.8115851
## me 0.9179043
## mi 0.9173505
## ml 0.8827355
## mp 0.8953015
## mr 0.8309562
## uk 1.0000000
##
## $cor_plot
tictoc::tic()
s_dist <- chooseGCM::dist_gcms(s, var_names, study_area_parana, method = "euclidean")
tictoc::toc()
## 1.97 sec elapsed
s_dist
## $distances
## ac ae cc ce ch cn cr ec
## ae 54.47124
## cc 60.97502 45.67764
## ce 67.69282 37.74716 44.06745
## ch 35.11046 40.91825 54.93781 51.08251
## cn 21.86691 47.13017 57.70270 61.22885 29.51943
## cr 23.11423 43.14590 52.06445 56.15147 24.87585 17.29473
## ec 52.25162 37.24804 58.00146 54.69320 40.25839 45.19972 44.87201
## ev 54.99029 38.63825 54.26838 49.34408 39.87511 45.34986 45.76077 19.68887
## fi 48.88133 35.19153 47.08655 38.40838 38.61647 41.37541 38.21058 42.46006
## gg 52.71586 29.29097 45.81040 33.40518 40.89179 45.97376 38.79266 47.65815
## gh 39.10154 52.73376 61.55347 65.34477 44.21923 37.76485 36.66726 52.51401
## hg 44.93537 33.76882 54.45234 51.56216 38.24506 39.13617 37.72676 31.20651
## ic 40.98013 35.71607 44.88900 43.01841 29.81456 35.07519 27.77889 49.60500
## in 67.54558 42.00297 45.96083 38.90564 55.35817 61.58325 55.35114 62.27236
## ip 72.71630 40.34185 34.40317 38.86408 63.07724 69.22429 62.38115 61.24981
## me 43.28376 33.12478 47.03572 43.90204 33.17286 36.63239 29.96553 49.00464
## mi 34.42954 41.31628 53.74710 53.75443 31.40872 31.61658 23.46588 47.05347
## ml 61.12924 33.51147 44.70036 31.38019 49.33358 55.44389 48.63993 54.68171
## mp 58.27191 28.80307 45.56397 31.79431 46.97615 52.62167 47.82183 51.94082
## mr 18.35301 59.33987 63.35165 71.09435 38.28136 27.54298 24.59523 56.47860
## uk 47.65210 30.75847 51.35703 49.28565 36.75439 40.94996 38.27005 27.92228
## ev fi gg gh hg ic in ip
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi 38.42399
## gg 44.83973 27.70046
## gh 55.12442 45.81558 45.04678
## hg 30.16535 27.71655 38.24386 46.59994
## ic 46.85332 33.55918 28.93946 47.45962 39.42604
## in 57.84837 43.32489 33.11860 66.74611 52.51767 38.81241
## ip 58.64488 51.64265 41.87967 67.94336 58.17724 51.40825 39.68740
## me 47.45484 34.32497 26.42635 45.55104 38.64510 13.35376 37.74542 50.80136
## mi 47.07096 37.08701 35.37894 45.59122 36.61285 23.87329 45.71214 60.18300
## ml 50.22589 33.98095 22.91290 56.81660 44.53997 35.62767 26.06765 36.01378
## mp 49.14655 30.71743 29.07163 54.89279 41.62423 36.13069 38.36887 39.90527
## mr 58.75442 51.14690 53.99271 34.28386 49.29606 43.60331 68.95284 73.90681
## uk 25.42320 32.23183 39.10882 51.80487 15.80756 37.15754 51.47248 55.32960
## me mi ml mp mr
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi
## gg
## gh
## hg
## ic
## in
## ip
## me
## mi 24.14047
## ml 33.32909 41.92014
## mp 34.86088 44.31340 22.55001
## mr 46.49687 36.96763 62.39038 61.15372
## uk 36.52247 36.64545 43.64989 41.24489 52.40824
##
## $heatmap
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3, method = "euclidean")
## $suggested_gcms
## 1 2 3
## "uk" "ml" "cr"
##
## $kmeans_plot
tictoc::toc()
## 3.014 sec elapsed
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "gg" "in" "ce"
##
## $kmeans_plot
tictoc::toc()
## 2.718 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "cr" "gg" "uk"
##
## $dend_plot
tictoc::toc()
## 2.409 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3, n = 1000)
## $suggested_gcms
## [1] "cr" "gg" "uk"
##
## $dend_plot
tictoc::toc()
## 2.396 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ac" "ae" "ic"
##
## $best_mean_diff
## [1] 0.004153943
##
## $global_mean
## [1] 43.71833
tictoc::toc()
## 2.187 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana)
## $suggested_gcms
## [1] "cc" "ch" "cr" "hg"
##
## $best_mean_diff
## [1] 0.00128081
##
## $global_mean
## [1] 43.71833
tictoc::toc()
## 2.382 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "wss", n = 1000)
tictoc::toc()
## 2.686 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "silhouette", n = 1000)
tictoc::toc()
## 2.197 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "gap_stat", n = 1000)
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
tictoc::toc()
## 43.429 sec elapsed
tictoc::tic()
chooseGCM::montecarlo_gcms(s, var_names, study_area_parana, perm = 10000, method = "euclidean")
## $montecarlo_plot
##
## $suggested_gcms
## $suggested_gcms$k2
## [1] "ml" "uk"
##
## $suggested_gcms$k3
## [1] "ac" "ae" "ic"
##
## $suggested_gcms$k4
## [1] "cc" "ch" "cr" "hg"
##
## $suggested_gcms$k5
## [1] "cr" "mr" "ev" "gg" "ae"
##
## $suggested_gcms$k6
## [1] "cc" "ic" "ip" "fi" "mi" "ch"
##
## $suggested_gcms$k7
## [1] "gh" "hg" "me" "mp" "ev" "cn" "ac"
##
## $suggested_gcms$k8
## [1] "ac" "in" "cr" "ch" "uk" "ev" "mr" "gg"
##
## $suggested_gcms$k9
## [1] "ce" "gh" "gg" "ic" "hg" "cn" "ac" "mr" "ae"
##
## $suggested_gcms$k10
## [1] "gh" "in" "gg" "fi" "ce" "mi" "ch" "cn" "uk" "ev"
##
## $suggested_gcms$k11
## [1] "cr" "ev" "gg" "ac" "gh" "ae" "mp" "ec" "ml" "cn" "mr"
##
## $suggested_gcms$k12
## [1] "ic" "ml" "ev" "ec" "cn" "mp" "ce" "mi" "in" "ch" "ac" "ae"
##
## $suggested_gcms$k13
## [1] "cc" "ic" "ip" "fi" "mi" "ch" "cn" "ml" "in" "hg" "ce" "uk" "ev"
##
## $suggested_gcms$k14
## [1] "ce" "ec" "uk" "ic" "cn" "mp" "ml" "in" "ev" "cr" "ac" "ch" "mr" "hg"
##
## $suggested_gcms$k15
## [1] "cn" "ip" "cr" "ic" "hg" "mp" "ac" "ml" "mr" "ae" "gh" "uk" "ev" "ch" "ec"
##
## $suggested_gcms$k16
## [1] "gh" "ml" "mp" "ce" "in" "ip" "ic" "mi" "cr" "ch" "uk" "hg" "cn" "ev" "ae"
## [16] "ec"
##
## $suggested_gcms$k17
## [1] "ch" "ic" "cc" "hg" "ml" "in" "ce" "cr" "cn" "ev" "mp" "ec" "mi" "ac" "ae"
## [16] "mr" "gg"
##
## $suggested_gcms$k18
## [1] "gh" "ml" "mp" "ce" "in" "ip" "ic" "mi" "cr" "ch" "uk" "hg" "cn" "ev" "ae"
## [16] "ec" "ac" "fi"
##
## $suggested_gcms$k19
## [1] "ce" "mp" "ev" "in" "hg" "ec" "ic" "cr" "cn" "ml" "ch" "ac" "ae" "mr" "fi"
## [16] "gh" "uk" "cc" "me"
##
## $suggested_gcms$k20
## [1] "cc" "gg" "mi" "ch" "in" "uk" "cn" "mp" "ce" "hg" "ev" "ec" "ml" "ip" "ic"
## [16] "cr" "ac" "ae" "mr" "fi"
##
## $suggested_gcms$k21
## [1] "ce" "ec" "uk" "ic" "cn" "mp" "ml" "in" "ev" "cr" "ac" "ch" "mr" "hg" "ae"
## [16] "gh" "gg" "cc" "me" "mi" "ip"
tictoc::toc()
## 19.535 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = res5$suggested_gcms$k3)
tictoc::toc()
## 3.355 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = "sum")
tictoc::toc()
## 3.457 sec elapsed
tictoc::tic()
s <- chooseGCM::import_gcms(path = "~/storage/WC_data/WC_data_all_gcms_25")
tictoc::toc()
## 0.581 sec elapsed
s
## $ac_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ac_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -2.6, -137.8, 6.5, -26.1, -65.4, ...
## max values : 38.5, 22.3, 94.6, 2256.7, 56.7, 31.1, ...
##
## $ae_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ae_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -1.2, -15.0, 8.8, -26.9, -67.5, ...
## max values : 37.1, 22.1, 94.5, 2241.0, 55.9, 29.9, ...
##
## $cc_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cc_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -45.1, -2.9, -51.9, 9.0, -25.5, -65.0, ...
## max values : 39.9, 22.2, 95.2, 2234.1, 58.6, 32.9, ...
##
## $ce_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ce_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.3, -3, -39.3, 8.1, -26.9, -67.5, ...
## max values : 37.4, 23, 95.8, 2293.0, 55.8, 30.0, ...
##
## $ch_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ch_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -3.2, -64.5, 9.6, -24.9, -67.6, ...
## max values : 38.0, 22.8, 94.7, 2265.5, 58.7, 30.3, ...
##
## $cn_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cn_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -3.2, -74.2, 10.0, -25.5, -66.6, ...
## max values : 38.0, 23.1, 95.0, 2171.8, 57.1, 30.4, ...
##
## $cr_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cr_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.8, -40.5, 7.2, -25.9, -67.8, ...
## max values : 37.6, 23.1, 95.7, 2192.1, 56.2, 30.1, ...
##
## $ec_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ec_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.7, -3.0, -34.1, 8.5, -26.5, -68.6, ...
## max values : 38.1, 22.1, 96.2, 2367.9, 56.0, 30.4, ...
##
## $ev_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ev_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.0, -2.7, -18.1, 9.9, -26.9, -67.1, ...
## max values : 38.1, 22.1, 96.3, 2366.4, 55.8, 30.3, ...
##
## $fi_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : fi_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.4, -2.8, -34.3, 9.1, -25.2, -66.7, ...
## max values : 37.1, 22.1, 95.3, 2194.6, 55.2, 29.8, ...
##
## $gg_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gg_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.1, -0.6, -5.1, 4.7, -27.0, -66.2, ...
## max values : 37.0, 22.2, 96.6, 2279.2, 55.2, 29.6, ...
##
## $gh_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gh_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -0.4, -3.9, 8.1, -27.2, -66.0, ...
## max values : 37.4, 22.9, 96.1, 2266.4, 55.8, 29.7, ...
##
## $hg_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : hg_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -2.9, -103.6, 8.4, -25.6, -66.6, ...
## max values : 38.7, 21.6, 95.8, 2300.9, 57.2, 32.2, ...
##
## $ic_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ic_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.0, -2.9, -45.3, 7.8, -26.9, -69.1, ...
## max values : 35.6, 22.8, 96.2, 2332.6, 52.8, 28.7, ...
##
## $in_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : in_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -2.2, -28.0, 5.8, -26.3, -67.2, ...
## max values : 35.9, 23.4, 95.3, 2350.8, 53.7, 29.2, ...
##
## $ip_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ip_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.6, -31.3, 8.6, -26.5, -65.5, ...
## max values : 38.1, 22.0, 94.8, 2199.1, 56.5, 31.1, ...
##
## $me_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : me_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.8, -1.0, -9.3, 7.8, -29.8, -69.2, ...
## max values : 36.4, 23.3, 95.0, 2246.0, 54.9, 29.4, ...
##
## $mi_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mi_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.4, -1.9, -15.0, 8.3, -28.5, -68.4, ...
## max values : 36.6, 23.3, 95.8, 2262.1, 55.4, 28.9, ...
##
## $ml_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ml_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.4, -0.9, -14.3, 8.6, -27.6, -68.8, ...
## max values : 35.6, 22.0, 96.3, 2257.2, 54.5, 29.4, ...
##
## $mp_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mp_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.8, -0.7, -7.7, 10.2, -27.7, -67.1, ...
## max values : 35.4, 21.9, 96.4, 2289.6, 53.9, 29.2, ...
##
## $mr_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mr_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.7, -1.8, -20.7, 7.5, -26.2, -68.3, ...
## max values : 36.7, 22.8, 95.0, 2161.6, 55.4, 29.5, ...
##
## $uk_ssp585_2.5_2090
## class : SpatRaster
## dimensions : 4320, 8640, 19 (nrow, ncol, nlyr)
## resolution : 0.04166667, 0.04166667 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : uk_ssp585_2.5_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.6, -3.7, -73.4, 6.2, -25.7, -66.6, ...
## max values : 39.0, 21.7, 95.6, 2330.6, 57.7, 31.7, ...
names(s)
## [1] "ac_ssp585_2.5_2090" "ae_ssp585_2.5_2090" "cc_ssp585_2.5_2090"
## [4] "ce_ssp585_2.5_2090" "ch_ssp585_2.5_2090" "cn_ssp585_2.5_2090"
## [7] "cr_ssp585_2.5_2090" "ec_ssp585_2.5_2090" "ev_ssp585_2.5_2090"
## [10] "fi_ssp585_2.5_2090" "gg_ssp585_2.5_2090" "gh_ssp585_2.5_2090"
## [13] "hg_ssp585_2.5_2090" "ic_ssp585_2.5_2090" "in_ssp585_2.5_2090"
## [16] "ip_ssp585_2.5_2090" "me_ssp585_2.5_2090" "mi_ssp585_2.5_2090"
## [19] "ml_ssp585_2.5_2090" "mp_ssp585_2.5_2090" "mr_ssp585_2.5_2090"
## [22] "uk_ssp585_2.5_2090"
names(s) <- gsub("_ssp585_2.5_2090", "", names(s))
names(s)
## [1] "ac" "ae" "cc" "ce" "ch" "cn" "cr" "ec" "ev" "fi" "gg" "gh" "hg" "ic" "in"
## [16] "ip" "me" "mi" "ml" "mp" "mr" "uk"
var_names <- c("bio5", "bio13", "bio15")
study_area_parana <- geodata::gadm(country = "Brazil", path = "input_data/") %>%
sf::st_as_sf() %>%
dplyr::filter(NAME_1 == "Paraná")
study_area_parana
## Simple feature collection with 1 feature and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -54.61602 ymin: -26.71712 xmax: -48.02354 ymax: -22.5163
## Geodetic CRS: WGS 84
## GID_1 GID_0 COUNTRY NAME_1 VARNAME_1 NL_NAME_1 TYPE_1 ENGTYPE_1 CC_1
## 1 BRA.16_1 BRA Brazil Paraná <NA> <NA> Estado State <NA>
## HASC_1 ISO_1 geometry
## 1 BR.PR <NA> MULTIPOLYGON (((-52.52423 -...
plot(study_area_parana$geometry)
tictoc::tic()
res25 <- chooseGCM::compare_gcms(s, var_names, study_area_parana, k = 3)
tictoc::toc()
## 43.466 sec elapsed
res25$statistics_gcms
tictoc::tic()
s_sum <- chooseGCM::summary_gcms(s, var_names, study_area_parana)
tictoc::toc()
## 6.326 sec elapsed
s_sum
## $ac
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 33.1 35 34.81437 36.5 39.2 2.070698 0
## bio13 218.0 283.0 314 324.21609 369.0 453.0 50.222811 0
## bio15 20.6 31.5 36 35.78631 39.9 54.4 6.340011 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ae
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.4 31.7 33.8 33.72196 35.6 39.1 2.417791 0
## bio13 161.0 206.0 236.0 232.93535 255.0 373.0 35.218328 0
## bio15 13.6 23.2 27.0 27.77290 32.3 50.5 6.856069 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $cc
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 30.6 36.9 40.4 40.10014 43.2 46.4 3.528354 0
## bio13 114.0 163.0 176.0 180.27033 192.0 275.0 23.590208 0
## bio15 25.2 36.2 41.4 41.69267 46.9 64.8 7.745826 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ce
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.3 31.0 33.3 33.0884 35.1 37.7 2.377210 0
## bio13 153.0 188.0 208.0 210.9456 228.0 365.0 31.883072 0
## bio15 21.6 30.4 34.5 35.6003 39.6 62.7 7.352477 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ch
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.0 32.8 35 34.73472 36.7 38.5 2.235619 0
## bio13 157.0 198.0 228 234.93781 264.0 368.0 43.146596 0
## bio15 20.8 29.6 34 33.95508 37.4 52.0 5.685894 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $cn
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.6 32.3 34.2 34.00039 35.7 38.1 2.024727 0
## bio13 158.0 202.0 232.0 244.01306 284.0 373.0 50.228169 0
## bio15 21.4 29.1 33.7 33.65463 37.5 51.6 5.615701 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $cr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.5 32.2 33.9 33.71662 35.3 37.7 1.884897 0
## bio13 149.0 198.0 225.0 230.09210 259.0 346.0 38.733435 0
## bio15 17.4 27.4 32.9 32.96107 37.9 52.1 7.025246 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ec
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.0 30.6 33.3 33.62576 36.4 40.6 3.307145 0
## bio13 149.0 191.0 221.0 223.46361 251.0 364.0 38.608722 0
## bio15 22.5 30.0 32.9 33.58756 37.1 49.3 4.745219 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ev
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.2 31.0 33.9 34.07875 36.9 41.0 3.414492 0
## bio13 142.0 179.0 203.0 208.89266 232.0 391.0 38.153353 0
## bio15 24.1 30.3 33.9 34.49860 37.8 52.4 5.031405 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $fi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.7 31.9 33.8 33.65872 35.4 38.7 2.105936 0
## bio13 150.0 201.0 220.0 226.25812 250.0 368.0 32.421047 0
## bio15 17.5 25.7 29.6 30.43187 33.9 52.6 6.260145 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $gg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.2 30.9 32.8 32.62626 34.4 36.9 2.083460 0
## bio13 136.0 176.0 197.0 197.28339 214.0 346.0 25.685600 0
## bio15 11.3 18.9 22.5 23.80977 27.7 47.2 6.771745 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $gh
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.1 30.7 32.8 32.61633 34.4 36.8 2.196212 0
## bio13 140.0 181.0 209.0 210.02735 238.0 312.0 31.756119 0
## bio15 18.7 25.7 28.1 29.35060 32.7 50.3 5.617285 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $hg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.8 34.5 36.7 36.48552 38.5 41.4 2.387960 0
## bio13 166.0 211.0 237.0 245.20502 278.0 399.0 42.331741 0
## bio15 14.4 23.1 27.0 27.88863 31.8 50.2 6.202554 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ic
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.6 30.8 32.5 32.37363 33.9 36.8 1.902466 0
## bio13 133.0 171.0 187.0 194.15977 214.0 324.0 30.043856 0
## bio15 14.0 24.0 27.8 28.78018 33.1 53.2 6.924022 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $`in`
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.9 30.8 32.5 32.43618 33.9 37.3 1.917950 0
## bio13 138.0 185.0 200.0 203.77832 215.0 401.0 28.110005 0
## bio15 13.4 23.6 27.9 28.78305 33.3 54.4 7.706249 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ip
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.5 32.9 35.8 35.48258 38.0 40.9 2.969116 0
## bio13 138.0 181.0 195.0 197.91065 212.0 323.0 22.638286 0
## bio15 14.9 26.5 32.7 33.33308 39.3 62.8 9.272308 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $me
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.9 29.6 31.4 31.29991 32.8 35.7 1.927461 0
## bio13 143.0 179.0 201.0 205.54274 227.0 347.0 30.934144 0
## bio15 15.3 25.9 28.8 29.80895 33.7 52.7 6.507155 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $mi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.5 32 33.1 33.04610 34.2 37.3 1.514641 0
## bio13 153.0 192 210.0 216.62111 241.0 358.0 31.500723 0
## bio15 16.6 26 29.2 29.67656 33.3 46.5 5.452674 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $ml
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.5 30.5 32.3 32.21425 33.8 37.3 1.980003 0
## bio13 133.0 173.0 189.0 190.65405 204.0 369.0 26.120074 0
## bio15 17.6 28.6 33.0 34.16302 39.6 59.0 8.348566 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $mp
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.2 30.3 32.0 31.95781 33.6 36.4 1.952084 0
## bio13 145.0 189.0 208.0 210.68557 230.0 321.0 29.173701 0
## bio15 14.6 25.4 29.4 30.83000 35.8 54.8 7.784779 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $mr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26 30.4 32.1 31.91638 33.4 36.5 1.844380 0
## bio13 165 212.0 244.0 245.64752 277.0 345.0 38.175787 0
## bio15 18 26.7 32.2 32.08751 37.0 51.6 6.996644 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
##
## $uk
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 28.8 34.1 36.3 36.22786 38.3 41.6 2.484018 0
## bio13 154.0 200.0 230.0 235.30185 267.0 412.0 45.061116 0
## bio15 16.6 25.9 30.3 30.72653 35.1 50.4 6.379371 0
## n_cells
## bio5 10565
## bio13 10565
## bio15 10565
tictoc::tic()
s_cor <- chooseGCM::cor_gcms(s, var_names, study_area_parana, method = "pearson")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
tictoc::toc()
## 6.173 sec elapsed
s_cor
## $cor_matrix
## ac ae cc ce ch cn cr
## ac 1.0000000 0.8139634 0.7660266 0.7170416 0.9224718 0.9702233 0.9658966
## ae 0.8139634 1.0000000 0.8721457 0.9141588 0.8959894 0.8602465 0.8847184
## cc 0.7660266 0.8721457 1.0000000 0.8818973 0.8132570 0.7916229 0.8311728
## ce 0.7170416 0.9141588 0.8818973 1.0000000 0.8414982 0.7690865 0.8076441
## ch 0.9224718 0.8959894 0.8132570 0.8414982 1.0000000 0.9444841 0.9612027
## cn 0.9702233 0.8602465 0.7916229 0.7690865 0.9444841 1.0000000 0.9809743
## cr 0.9658966 0.8847184 0.8311728 0.8076441 0.9612027 0.9809743 1.0000000
## ec 0.8292531 0.9127099 0.7912343 0.8150938 0.8982918 0.8695877 0.8737704
## ev 0.8121408 0.9068271 0.8182531 0.8500225 0.9011063 0.8701153 0.8700056
## fi 0.8512930 0.9235382 0.8630133 0.9105928 0.9079849 0.8930941 0.9101423
## gg 0.8255113 0.9479410 0.8702269 0.9320368 0.8963244 0.8676820 0.9068132
## gh 0.9053932 0.8260056 0.7622048 0.7355096 0.8776910 0.9106629 0.9160188
## hg 0.8736136 0.9278481 0.8149989 0.8357167 0.9089380 0.9029207 0.9114124
## ic 0.8915587 0.9219260 0.8745909 0.8892081 0.9436927 0.9213137 0.9509209
## in 0.7126622 0.8917251 0.8681968 0.9075340 0.8100354 0.7630045 0.8097460
## ip 0.6700354 0.9016883 0.9276154 0.9073025 0.7550769 0.7024335 0.7598833
## me 0.8805320 0.9321738 0.8622398 0.8827470 0.9306083 0.9149107 0.9436198
## mi 0.9237415 0.8943422 0.8193965 0.8240080 0.9381709 0.9363030 0.9652732
## ml 0.7669815 0.9319328 0.8768782 0.9393056 0.8510253 0.8092807 0.8550163
## mp 0.7886378 0.9489019 0.8727291 0.9377957 0.8642615 0.8280200 0.8596392
## mr 0.9789484 0.7812845 0.7488343 0.6900854 0.9087668 0.9530417 0.9622767
## uk 0.8569844 0.9400702 0.8357713 0.8505844 0.9155305 0.8929814 0.9082729
## ec ev fi gg gh hg ic
## ac 0.8292531 0.8121408 0.8512930 0.8255113 0.9053932 0.8736136 0.8915587
## ae 0.9127099 0.9068271 0.9235382 0.9479410 0.8260056 0.9278481 0.9219260
## cc 0.7912343 0.8182531 0.8630133 0.8702269 0.7622048 0.8149989 0.8745909
## ce 0.8150938 0.8500225 0.9105928 0.9320368 0.7355096 0.8357167 0.8892081
## ch 0.8982918 0.9011063 0.9079849 0.8963244 0.8776910 0.9089380 0.9436927
## cn 0.8695877 0.8701153 0.8930941 0.8676820 0.9106629 0.9029207 0.9213137
## cr 0.8737704 0.8700056 0.9101423 0.9068132 0.9160188 0.9114124 0.9509209
## ec 1.0000000 0.9755105 0.8875107 0.8578928 0.8261871 0.9394486 0.8454175
## ev 0.9755105 1.0000000 0.9084734 0.8749150 0.8081205 0.9439760 0.8635806
## fi 0.8875107 0.9084734 1.0000000 0.9525805 0.8665929 0.9516840 0.9307297
## gg 0.8578928 0.8749150 0.9525805 1.0000000 0.8717270 0.9087216 0.9491121
## gh 0.8261871 0.8081205 0.8665929 0.8717270 1.0000000 0.8622663 0.8570566
## hg 0.9394486 0.9439760 0.9516840 0.9087216 0.8622663 1.0000000 0.9025565
## ic 0.8454175 0.8635806 0.9307297 0.9491121 0.8570566 0.9025565 1.0000000
## in 0.7580735 0.7923567 0.8837378 0.9324902 0.7204920 0.8277283 0.9090227
## ip 0.7678969 0.7877979 0.8357978 0.8924127 0.7130811 0.7899364 0.8384474
## me 0.8484223 0.8588014 0.9265864 0.9570321 0.8692828 0.9055871 0.9887543
## mi 0.8619878 0.8632656 0.9155943 0.9228638 0.8683484 0.9173029 0.9638589
## ml 0.8139239 0.8433665 0.9281967 0.9679137 0.7984960 0.8758055 0.9243846
## mp 0.8308353 0.8490195 0.9410524 0.9479968 0.8117982 0.8905020 0.9213531
## mr 0.8012067 0.7859672 0.8377552 0.8186911 0.9272637 0.8486943 0.8796563
## uk 0.9508075 0.9600317 0.9352800 0.9051894 0.8301024 0.9843985 0.9138400
## in ip me mi ml mp mr
## ac 0.7126622 0.6700354 0.8805320 0.9237415 0.7669815 0.7886378 0.9789484
## ae 0.8917251 0.9016883 0.9321738 0.8943422 0.9319328 0.9489019 0.7812845
## cc 0.8681968 0.9276154 0.8622398 0.8193965 0.8768782 0.8727291 0.7488343
## ce 0.9075340 0.9073025 0.8827470 0.8240080 0.9393056 0.9377957 0.6900854
## ch 0.8100354 0.7550769 0.9306083 0.9381709 0.8510253 0.8642615 0.9087668
## cn 0.7630045 0.7024335 0.9149107 0.9363030 0.8092807 0.8280200 0.9530417
## cr 0.8097460 0.7598833 0.9436198 0.9652732 0.8550163 0.8596392 0.9622767
## ec 0.7580735 0.7678969 0.8484223 0.8619878 0.8139239 0.8308353 0.8012067
## ev 0.7923567 0.7877979 0.8588014 0.8632656 0.8433665 0.8490195 0.7859672
## fi 0.8837378 0.8357978 0.9265864 0.9155943 0.9281967 0.9410524 0.8377552
## gg 0.9324902 0.8924127 0.9570321 0.9228638 0.9679137 0.9479968 0.8186911
## gh 0.7204920 0.7130811 0.8692828 0.8683484 0.7984960 0.8117982 0.9272637
## hg 0.8277283 0.7899364 0.9055871 0.9173029 0.8758055 0.8905020 0.8486943
## ic 0.9090227 0.8384474 0.9887543 0.9638589 0.9243846 0.9213531 0.8796563
## in 1.0000000 0.9020456 0.9125106 0.8707731 0.9583955 0.9097444 0.7038034
## ip 0.9020456 1.0000000 0.8418173 0.7759449 0.9202445 0.9027850 0.6611266
## me 0.9125106 0.8418173 1.0000000 0.9631809 0.9328323 0.9259360 0.8645564
## mi 0.8707731 0.7759449 0.9631809 1.0000000 0.8927420 0.8793438 0.9136859
## ml 0.9583955 0.9202445 0.9328323 0.8927420 1.0000000 0.9686977 0.7598528
## mp 0.9097444 0.9027850 0.9259360 0.8793438 0.9686977 1.0000000 0.7692037
## mr 0.7038034 0.6611266 0.8645564 0.9136859 0.7598528 0.7692037 1.0000000
## uk 0.8358001 0.8108835 0.9159435 0.9171095 0.8818385 0.8932666 0.8283864
## uk
## ac 0.8569844
## ae 0.9400702
## cc 0.8357713
## ce 0.8505844
## ch 0.9155305
## cn 0.8929814
## cr 0.9082729
## ec 0.9508075
## ev 0.9600317
## fi 0.9352800
## gg 0.9051894
## gh 0.8301024
## hg 0.9843985
## ic 0.9138400
## in 0.8358001
## ip 0.8108835
## me 0.9159435
## mi 0.9171095
## ml 0.8818385
## mp 0.8932666
## mr 0.8283864
## uk 1.0000000
##
## $cor_plot
tictoc::tic()
s_dist <- chooseGCM::dist_gcms(s, var_names, study_area_parana, method = "euclidean")
tictoc::toc()
## 6.117 sec elapsed
s_dist
## $distances
## ac ae cc ce ch cn cr
## ae 108.58979
## cc 121.77917 90.02174
## ce 133.92174 73.76287 86.52065
## ch 70.10028 81.19487 108.79575 100.23213
## cn 43.44385 94.11767 114.92507 120.98026 59.31966
## cr 46.49308 85.48106 103.44537 110.41868 49.58962 34.72643
## ec 104.03183 74.38278 115.03220 108.25938 80.29119 90.91783 89.44796
## ev 109.12041 76.84835 107.33055 97.49961 79.17246 90.73374 90.77205
## fi 97.08574 69.61648 93.18137 75.27940 76.36941 82.31720 75.46880
## gg 105.16556 57.44306 90.69474 65.63366 81.06400 91.57971 76.85410
## gh 77.43743 105.01649 122.76974 129.47764 88.04792 75.24988 72.95934
## hg 89.50349 67.62598 108.28716 102.04378 75.97284 78.44283 74.93356
## ic 82.90623 70.34661 89.15676 83.79997 59.74098 70.62190 55.77482
## in 134.95413 82.84259 91.40140 76.55629 109.73019 122.56313 109.81376
## ip 144.61837 78.93916 67.73495 76.65205 124.59618 137.33520 123.36757
## me 87.01931 65.56748 93.44405 86.20883 66.31984 73.43910 59.77963
## mi 69.52388 81.83527 106.99241 105.61759 62.60172 63.54029 46.91612
## ml 121.53042 65.68389 88.33998 62.02463 97.17311 109.94796 95.86265
## mp 115.74534 56.91048 89.81615 62.79138 92.75585 104.40679 94.32193
## mr 36.52858 117.74150 126.17404 140.15573 76.04421 54.55644 48.89839
## uk 95.20979 61.63272 102.02682 97.31680 73.17113 82.36058 76.24980
## ec ev fi gg gh hg ic
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev 39.39852
## fi 84.43946 76.16640
## gg 94.90693 89.04150 54.82371
## gh 104.96168 110.28186 91.95582 90.16905
## hg 61.95153 59.59046 55.33950 76.06307 93.43506
## ic 98.98513 92.98822 66.26183 56.79328 95.18573 78.58982
## in 123.83161 114.72254 85.84383 65.41440 133.10272 104.49531 75.93749
## ip 121.29148 115.97508 102.01858 82.57913 134.85574 115.38921 101.19213
## me 98.01836 94.60301 68.21472 52.18694 91.02407 77.35804 26.69824
## mi 93.52950 93.09551 73.14351 69.92282 91.34880 72.39941 47.86194
## ml 108.60134 99.63963 67.46242 45.09723 113.01384 88.72396 69.23011
## mp 103.54870 97.82509 61.12557 57.41229 109.21987 83.30921 70.60421
## mr 112.25112 116.47426 101.40870 107.20112 67.89931 97.93039 87.33767
## uk 55.83923 50.33238 64.04852 77.52082 103.77278 31.44655 73.89971
## in ip me mi ml mp mr
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi
## gg
## gh
## hg
## ic
## in
## ip 78.79557
## me 74.46765 100.13118
## mi 90.50367 119.17009 48.30881
## ml 51.35231 71.10008 65.24845 82.45267
## mp 75.63573 78.49763 68.51621 87.45096 44.54282
## mr 137.01871 146.55768 92.65505 73.96574 123.37541 120.94956
## uk 102.01788 109.48499 72.99205 72.48403 86.54219 82.25078 104.29552
##
## $heatmap
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3, method = "euclidean")
## $suggested_gcms
## 1 2 3
## "uk" "ml" "cr"
##
## $kmeans_plot
tictoc::toc()
## 7.306 sec elapsed
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ec" "ic" "mi"
##
## $kmeans_plot
tictoc::toc()
## 7.053 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ch" "ae" "ev"
##
## $dend_plot
tictoc::toc()
## 7.064 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3, n = 1000)
## $suggested_gcms
## [1] "ch" "ae" "ev"
##
## $dend_plot
tictoc::toc()
## 6.551 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ec" "gh" "hg"
##
## $best_mean_diff
## [1] 0.007094148
##
## $global_mean
## [1] 86.77566
tictoc::toc()
## 6.226 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana)
## $suggested_gcms
## [1] "cn" "gg" "gh" "uk"
##
## $best_mean_diff
## [1] 0.0001932705
##
## $global_mean
## [1] 86.77566
tictoc::toc()
## 6.723 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "wss", n = 1000)
tictoc::toc()
## 6.065 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "silhouette", n = 1000)
tictoc::toc()
## 5.986 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "gap_stat", n = 1000)
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
tictoc::toc()
## 47.38 sec elapsed
tictoc::tic()
chooseGCM::montecarlo_gcms(s, var_names, study_area_parana, perm = 10000, method = "euclidean")
## $montecarlo_plot
##
## $suggested_gcms
## $suggested_gcms$k2
## [1] "ml" "uk"
##
## $suggested_gcms$k3
## [1] "ec" "gh" "hg"
##
## $suggested_gcms$k4
## [1] "cn" "gg" "gh" "uk"
##
## $suggested_gcms$k5
## [1] "cc" "ch" "cr" "hg" "ec"
##
## $suggested_gcms$k6
## [1] "cr" "ev" "gg" "ac" "gh" "ae"
##
## $suggested_gcms$k7
## [1] "fi" "ic" "mr" "ml" "in" "ce" "ch"
##
## $suggested_gcms$k8
## [1] "ic" "uk" "cc" "ev" "cn" "mp" "ec" "ml"
##
## $suggested_gcms$k9
## [1] "fi" "ip" "cc" "ic" "mi" "ch" "cn" "ml" "ce"
##
## $suggested_gcms$k10
## [1] "gg" "mp" "gh" "uk" "ev" "cn" "ml" "ce" "ch" "ec"
##
## $suggested_gcms$k11
## [1] "gg" "ic" "mr" "in" "cn" "hg" "mp" "ac" "gh" "uk" "ml"
##
## $suggested_gcms$k12
## [1] "ae" "cc" "in" "fi" "mi" "ch" "ce" "hg" "ev" "ec" "cn" "mp"
##
## $suggested_gcms$k13
## [1] "gg" "ic" "mr" "in" "cn" "hg" "mp" "ac" "gh" "uk" "ml" "ae" "ev"
##
## $suggested_gcms$k14
## [1] "gh" "ip" "gg" "ml" "in" "mi" "ce" "cr" "ae" "hg" "ch" "cn" "uk" "ev"
##
## $suggested_gcms$k15
## [1] "ac" "cc" "cr" "me" "hg" "mp" "ml" "in" "ch" "cn" "mr" "ae" "ev" "uk" "ec"
##
## $suggested_gcms$k16
## [1] "gh" "in" "gg" "fi" "ce" "hg" "cr" "cn" "ac" "ml" "uk" "ev" "ec" "mp" "ch"
## [16] "mr"
##
## $suggested_gcms$k17
## [1] "ch" "ic" "cc" "hg" "ml" "ev" "cn" "ec" "mp" "ce" "mi" "in" "cr" "ac" "ae"
## [16] "mr" "fi"
##
## $suggested_gcms$k18
## [1] "gh" "ml" "mp" "ce" "in" "ip" "cc" "ic" "mi" "fi" "uk" "cr" "ch" "hg" "cn"
## [16] "ev" "ae" "ec"
##
## $suggested_gcms$k19
## [1] "cr" "ic" "ce" "mr" "ae" "hg" "ev" "ml" "ec" "cn" "ac" "mp" "gh" "gg" "ch"
## [16] "in" "uk" "cc" "me"
##
## $suggested_gcms$k20
## [1] "ae" "cc" "in" "fi" "mi" "ch" "ce" "hg" "ev" "ec" "cn" "mp" "ml" "ip" "me"
## [16] "cr" "ac" "uk" "mr" "gg"
##
## $suggested_gcms$k21
## [1] "cr" "ic" "ce" "mr" "ae" "hg" "ev" "ml" "ec" "cn" "ac" "mp" "gh" "gg" "ch"
## [16] "in" "uk" "cc" "me" "mi" "ip"
tictoc::toc()
## 25.47 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = res25$suggested_gcms$k3)
tictoc::toc()
## 9.72 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = "sum")
tictoc::toc()
## 9.59 sec elapsed
tictoc::tic()
s <- chooseGCM::import_gcms(path = "~/storage/WC_data/WC_data_all_gcms_30")
tictoc::toc()
## 0.854 sec elapsed
s
## $ac_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ac_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.0, -4.1, -248.1, 5.4, -26.5, -65.4, ...
## max values : 38.5, 22.5, 95.0, 2265.1, 56.8, 31.1, ...
##
## $ae_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ae_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.5, -0.9, -17.2, 9.4, -27.1, -67.5, ...
## max values : 37.3, 22.4, 94.7, 2243.5, 56.0, 29.9, ...
##
## $cc_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cc_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -45.1, -3.0, -51.9, 8.2, -25.9, -65.0, ...
## max values : 40.0, 22.5, 95.7, 2236.2, 58.7, 33.1, ...
##
## $ce_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ce_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.3, -3.0, -39.4, 8.1, -27.3, -67.5, ...
## max values : 37.5, 23.4, 95.8, 2295.4, 56.0, 30.0, ...
##
## $ch_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ch_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.9, -3.3, -42.9, 9.5, -25.3, -67.6, ...
## max values : 38.1, 23.1, 95.2, 2269.5, 58.8, 30.3, ...
##
## $cn_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cn_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -3.2, -30.5, 10.1, -25.9, -66.6, ...
## max values : 38.2, 23.4, 95.5, 2175.4, 57.2, 30.4, ...
##
## $cr_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : cr_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.8, -24.4, 7.6, -26.3, -67.8, ...
## max values : 37.7, 23.4, 96.4, 2195.7, 56.4, 30.2, ...
##
## $ec_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ec_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.7, -3.0, -34.1, 8.5, -27.0, -68.6, ...
## max values : 38.2, 22.4, 97.0, 2370.9, 56.2, 30.6, ...
##
## $ev_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ev_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.0, -2.8, -18.1, 9.0, -27.4, -67.2, ...
## max values : 38.2, 22.3, 96.4, 2368.5, 56.0, 30.3, ...
##
## $fi_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : fi_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.4, -2.9, -41.7, 8.7, -25.6, -66.8, ...
## max values : 37.2, 22.4, 95.6, 2195.8, 55.3, 29.9, ...
##
## $gg_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gg_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.1, -0.6, -5.3, 5.8, -27.4, -66.2, ...
## max values : 37.1, 22.6, 97.3, 2282.3, 55.3, 29.7, ...
##
## $gh_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : gh_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -0.4, -5.2, 5.7, -27.7, -66.0, ...
## max values : 37.5, 23.1, 96.6, 2268.4, 55.9, 29.7, ...
##
## $hg_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : hg_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.8, -3.1, -112.8, 7.0, -26.0, -66.7, ...
## max values : 38.8, 21.8, 96.3, 2304.8, 57.4, 32.3, ...
##
## $ic_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ic_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.0, -3.3, -51.2, 7.7, -27.4, -69.2, ...
## max values : 35.8, 23.1, 96.1, 2335.2, 52.9, 28.8, ...
##
## $in_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : in_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.6, -2.2, -28.9, 5.4, -26.7, -67.2, ...
## max values : 36.0, 23.7, 95.7, 2353.8, 53.8, 29.3, ...
##
## $ip_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ip_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -48.5, -2.7, -38.4, 6.8, -26.9, -65.5, ...
## max values : 38.3, 22.3, 95.3, 2200.0, 56.9, 31.1, ...
##
## $me_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : me_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.8, -1.0, -10.0, 5.6, -30.3, -69.3, ...
## max values : 36.4, 23.6, 95.4, 2250.7, 55.1, 29.4, ...
##
## $mi_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mi_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.4, -2.0, -15.3, 7.0, -29.0, -68.4, ...
## max values : 36.7, 23.6, 95.9, 2264.9, 55.5, 28.9, ...
##
## $ml_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : ml_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -50.4, -0.9, -23.0, 8.2, -28.0, -68.8, ...
## max values : 35.8, 22.2, 96.7, 2261.7, 54.7, 29.4, ...
##
## $mp_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mp_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.8, -0.7, -7.7, 9.9, -28.1, -67.2, ...
## max values : 35.5, 22.2, 96.9, 2292.6, 54.0, 29.3, ...
##
## $mr_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : mr_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -49.7, -1.8, -21.3, 7.2, -26.7, -68.3, ...
## max values : 36.8, 23.1, 95.8, 2163.8, 55.6, 29.5, ...
##
## $uk_ssp585_30_2090
## class : SpatRaster
## dimensions : 21600, 43200, 19 (nrow, ncol, nlyr)
## resolution : 0.008333333, 0.008333333 (x, y)
## extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : uk_ssp585_30_2090.tif
## names : bio1, bio2, bio3, bio4, bio5, bio6, ...
## min values : -47.6, -3.7, -92.3, 6.4, -26.1, -66.6, ...
## max values : 39.2, 22.0, 95.9, 2335.8, 57.8, 31.8, ...
names(s)
## [1] "ac_ssp585_30_2090" "ae_ssp585_30_2090" "cc_ssp585_30_2090"
## [4] "ce_ssp585_30_2090" "ch_ssp585_30_2090" "cn_ssp585_30_2090"
## [7] "cr_ssp585_30_2090" "ec_ssp585_30_2090" "ev_ssp585_30_2090"
## [10] "fi_ssp585_30_2090" "gg_ssp585_30_2090" "gh_ssp585_30_2090"
## [13] "hg_ssp585_30_2090" "ic_ssp585_30_2090" "in_ssp585_30_2090"
## [16] "ip_ssp585_30_2090" "me_ssp585_30_2090" "mi_ssp585_30_2090"
## [19] "ml_ssp585_30_2090" "mp_ssp585_30_2090" "mr_ssp585_30_2090"
## [22] "uk_ssp585_30_2090"
names(s) <- gsub("_ssp585_30_2090", "", names(s))
names(s)
## [1] "ac" "ae" "cc" "ce" "ch" "cn" "cr" "ec" "ev" "fi" "gg" "gh" "hg" "ic" "in"
## [16] "ip" "me" "mi" "ml" "mp" "mr" "uk"
var_names <- c("bio5", "bio13", "bio15")
study_area_parana <- geodata::gadm(country = "Brazil", path = "input_data/") %>%
sf::st_as_sf() %>%
dplyr::filter(NAME_1 == "Paraná")
study_area_parana
## Simple feature collection with 1 feature and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -54.61602 ymin: -26.71712 xmax: -48.02354 ymax: -22.5163
## Geodetic CRS: WGS 84
## GID_1 GID_0 COUNTRY NAME_1 VARNAME_1 NL_NAME_1 TYPE_1 ENGTYPE_1 CC_1
## 1 BRA.16_1 BRA Brazil Paraná <NA> <NA> Estado State <NA>
## HASC_1 ISO_1 geometry
## 1 BR.PR <NA> MULTIPOLYGON (((-52.52423 -...
plot(study_area_parana$geometry)
tictoc::tic()
res30 <- chooseGCM::compare_gcms(s, var_names, study_area_parana, k = 3)
tictoc::toc()
## 694.261 sec elapsed
res30$statistics_gcms
tictoc::tic()
s_sum <- chooseGCM::summary_gcms(s, var_names, study_area_parana)
tictoc::toc()
## 164.354 sec elapsed
s_sum
## $ac
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.5 33.0 35.0 34.75674 36.4 39.3 2.077827 0
## bio13 214.0 283.0 314.0 324.63327 369.0 455.0 50.329865 0
## bio15 20.2 31.5 36.1 35.78898 39.9 55.7 6.230651 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ae
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.1 31.7 33.9 33.74596 35.6 39.3 2.439592 0
## bio13 157.0 206.0 236.0 232.67113 255.0 379.0 34.781844 0
## bio15 13.4 23.2 27.0 27.73133 32.2 51.7 6.729268 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $cc
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 29.2 36.9 40.4 40.09979 43.2 46.7 3.516034 0
## bio13 107.0 163.0 176.0 180.22665 192.0 278.0 23.504125 0
## bio15 24.4 36.3 41.4 41.67614 46.9 66.1 7.633916 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ce
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.6 31.0 33.3 33.08079 35.1 37.8 2.374806 0
## bio13 152.0 188.0 207.0 210.46166 228.0 370.0 31.188642 0
## bio15 21.2 30.4 34.5 35.54252 39.5 63.9 7.192804 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ch
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.6 32.8 35 34.72802 36.6 38.7 2.239152 0
## bio13 154.0 198.0 228 234.55525 264.0 376.0 42.739476 0
## bio15 20.4 29.6 34 33.91930 37.4 53.2 5.585811 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $cn
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.2 32.3 34.2 33.99002 35.7 38.3 2.027334 0
## bio13 153.0 203.0 232.0 243.98954 284.0 380.0 50.099918 0
## bio15 21.2 29.1 33.6 33.61266 37.5 53.0 5.524555 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $cr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26 32.2 33.9 33.70654 35.3 37.9 1.889443 0
## bio13 143 198.0 225.0 230.05778 259.0 352.0 38.571128 0
## bio15 17 27.4 32.9 32.93161 37.9 53.3 6.919618 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ec
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.4 30.6 33.4 33.61642 36.4 40.7 3.299915 0
## bio13 148.0 191.0 221.0 223.14491 250.0 371.0 38.246157 0
## bio15 21.8 30.0 32.8 33.54136 37.1 50.3 4.667012 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ev
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.5 31.0 34.0 34.07207 36.9 41.1 3.405777 0
## bio13 140.0 179.0 203.0 208.39762 231.0 398.0 37.525993 0
## bio15 23.9 30.3 33.9 34.41288 37.7 53.6 4.930344 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $fi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.2 31.9 33.8 33.64941 35.3 38.9 2.108811 0
## bio13 144.0 201.0 220.0 225.98815 250.0 374.0 32.167207 0
## bio15 16.9 25.7 29.6 30.37168 33.8 53.7 6.142075 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $gg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.7 30.8 32.8 32.61777 34.4 37.1 2.087161 0
## bio13 131.0 176.0 197.0 197.05508 214.0 352.0 25.274637 0
## bio15 11.1 18.9 22.5 23.73213 27.6 48.6 6.627553 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $gh
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.5 30.7 32.8 32.60603 34.4 37.0 2.199312 0
## bio13 135.0 181.0 209.0 210.06508 238.0 316.0 31.749807 0
## bio15 17.7 25.7 28.2 29.31666 32.7 50.5 5.516647 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $hg
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.4 34.5 36.7 36.47726 38.5 41.6 2.381972 0
## bio13 165.0 211.0 238.0 245.02011 277.0 406.0 42.150030 0
## bio15 13.8 23.1 26.9 27.81881 31.7 51.2 6.079749 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ic
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.1 30.8 32.5 32.35828 33.9 36.9 1.906742 0
## bio13 129.0 171.0 187.0 193.92037 214.0 329.0 29.564723 0
## bio15 13.8 24.1 27.8 28.71757 32.9 54.2 6.770720 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $`in`
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.5 30.8 32.5 32.41968 33.9 37.5 1.923271 0
## bio13 127.0 185.0 200.0 203.36371 215.0 408.0 27.091040 0
## bio15 13.3 23.6 27.9 28.69262 33.1 55.8 7.541156 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ip
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.0 32.9 35.8 35.47902 37.9 41 2.961617 0
## bio13 129.0 181.0 195.0 197.77569 212.0 327 22.387017 0
## bio15 14.2 26.6 32.7 33.27870 39.3 64 9.125891 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $me
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.4 29.6 31.4 31.28042 32.8 35.8 1.934235 0
## bio13 138.0 179.0 201.0 205.36992 227.0 353.0 30.548244 0
## bio15 15.1 26.0 28.8 29.75098 33.5 53.8 6.366499 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $mi
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 26.1 32.0 33.1 33.03503 34.2 37.5 1.520775 0
## bio13 148.0 192.0 210.0 216.55162 241.0 364.0 31.172976 0
## bio15 16.3 26.1 29.1 29.63360 33.2 47.9 5.356427 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $ml
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 25.0 30.5 32.3 32.19734 33.8 37.4 1.983525 0
## bio13 125.0 173.0 189.0 190.29838 204.0 376.0 25.444389 0
## bio15 17.2 28.6 32.9 34.07315 39.4 60.2 8.195698 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $mp
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.7 30.3 32.0 31.94418 33.5 36.6 1.959191 0
## bio13 143.0 189.0 208.0 210.45254 230.0 323.0 28.908881 0
## bio15 14.3 25.4 29.3 30.76926 35.6 55.9 7.650058 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $mr
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 24.4 30.4 32.1 31.90439 33.4 36.7 1.848709 0
## bio13 161.0 213.0 244.0 245.84422 277.0 351.0 38.197486 0
## bio15 17.5 26.7 32.2 32.07687 36.9 52.7 6.886176 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
##
## $uk
## min quantile_0.25 median mean quantile_0.75 max sd NAs
## bio5 27.4 34.1 36.3 36.21627 38.2 41.7 2.476925 0
## bio13 153.0 200.0 230.0 235.05300 267.0 419.0 44.655216 0
## bio15 16.0 25.9 30.2 30.65224 35.0 51.5 6.264661 0
## n_cells
## bio5 257025
## bio13 257025
## bio15 257025
tictoc::tic()
s_cor <- chooseGCM::cor_gcms(s, var_names, study_area_parana, method = "pearson")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
tictoc::toc()
## 155.123 sec elapsed
s_cor
## $cor_matrix
## ac ae cc ce ch cn cr
## ac 1.0000000 0.8122169 0.7631950 0.7181001 0.9234464 0.9709334 0.9663427
## ae 0.8122169 1.0000000 0.8703251 0.9121158 0.8923309 0.8572799 0.8818220
## cc 0.7631950 0.8703251 1.0000000 0.8811335 0.8100562 0.7888204 0.8286444
## ce 0.7181001 0.9121158 0.8811335 1.0000000 0.8398084 0.7681467 0.8067192
## ch 0.9234464 0.8923309 0.8100562 0.8398084 1.0000000 0.9434662 0.9604242
## cn 0.9709334 0.8572799 0.7888204 0.7681467 0.9434662 1.0000000 0.9806253
## cr 0.9663427 0.8818220 0.8286444 0.8067192 0.9604242 0.9806253 1.0000000
## ec 0.8299194 0.9119940 0.7879480 0.8122462 0.8959176 0.8662008 0.8715415
## ev 0.8148219 0.9058234 0.8159014 0.8470654 0.8995525 0.8682990 0.8689294
## fi 0.8517183 0.9200224 0.8610767 0.9106371 0.9065536 0.8919529 0.9093529
## gg 0.8274711 0.9459869 0.8687243 0.9303050 0.8948594 0.8678876 0.9071590
## gh 0.9047391 0.8238235 0.7589175 0.7346299 0.8766590 0.9095123 0.9152722
## hg 0.8733453 0.9243747 0.8109585 0.8332653 0.9074649 0.9008316 0.9102628
## ic 0.8946344 0.9194481 0.8734300 0.8871011 0.9437644 0.9226586 0.9520516
## in 0.7163084 0.8901462 0.8716802 0.9063986 0.8097551 0.7650386 0.8114641
## ip 0.6678120 0.8998447 0.9267088 0.9042132 0.7502500 0.6992203 0.7572218
## me 0.8828578 0.9302295 0.8610349 0.8811572 0.9300722 0.9153716 0.9441448
## mi 0.9258046 0.8907080 0.8161957 0.8212276 0.9375651 0.9364120 0.9655690
## ml 0.7698211 0.9304987 0.8780415 0.9377515 0.8499866 0.8097391 0.8557565
## mp 0.7884819 0.9466662 0.8722286 0.9368151 0.8618343 0.8261087 0.8582088
## mr 0.9787688 0.7783074 0.7462309 0.6897783 0.9087588 0.9530833 0.9623545
## uk 0.8574360 0.9377628 0.8322850 0.8480601 0.9141493 0.8905188 0.9069894
## ec ev fi gg gh hg ic
## ac 0.8299194 0.8148219 0.8517183 0.8274711 0.9047391 0.8733453 0.8946344
## ae 0.9119940 0.9058234 0.9200224 0.9459869 0.8238235 0.9243747 0.9194481
## cc 0.7879480 0.8159014 0.8610767 0.8687243 0.7589175 0.8109585 0.8734300
## ce 0.8122462 0.8470654 0.9106371 0.9303050 0.7346299 0.8332653 0.8871011
## ch 0.8959176 0.8995525 0.9065536 0.8948594 0.8766590 0.9074649 0.9437644
## cn 0.8662008 0.8682990 0.8919529 0.8678876 0.9095123 0.9008316 0.9226586
## cr 0.8715415 0.8689294 0.9093529 0.9071590 0.9152722 0.9102628 0.9520516
## ec 1.0000000 0.9753724 0.8864028 0.8561723 0.8238840 0.9396579 0.8433270
## ev 0.9753724 1.0000000 0.9078687 0.8725271 0.8063192 0.9446322 0.8615965
## fi 0.8864028 0.9078687 1.0000000 0.9519691 0.8644760 0.9505620 0.9298323
## gg 0.8561723 0.8725271 0.9519691 1.0000000 0.8734460 0.9072493 0.9474428
## gh 0.8238840 0.8063192 0.8644760 0.8734460 1.0000000 0.8600696 0.8580527
## hg 0.9396579 0.9446322 0.9505620 0.9072493 0.8600696 1.0000000 0.9013030
## ic 0.8433270 0.8615965 0.9298323 0.9474428 0.8580527 0.9013030 1.0000000
## in 0.7574501 0.7909861 0.8841298 0.9314788 0.7230154 0.8271817 0.9068264
## ip 0.7639798 0.7832689 0.8325297 0.8903918 0.7118162 0.7852168 0.8350921
## me 0.8461826 0.8567366 0.9251953 0.9563779 0.8702427 0.9040857 0.9885066
## mi 0.8612079 0.8627164 0.9144137 0.9212905 0.8677590 0.9172838 0.9630508
## ml 0.8124197 0.8409222 0.9274384 0.9673255 0.8009331 0.8742053 0.9225953
## mp 0.8273344 0.8456542 0.9392771 0.9467776 0.8106824 0.8873043 0.9201154
## mr 0.8001243 0.7863723 0.8373880 0.8197287 0.9266135 0.8483624 0.8813570
## uk 0.9507879 0.9603673 0.9340114 0.9030902 0.8280109 0.9842943 0.9122564
## in ip me mi ml mp mr
## ac 0.7163084 0.6678120 0.8828578 0.9258046 0.7698211 0.7884819 0.9787688
## ae 0.8901462 0.8998447 0.9302295 0.8907080 0.9304987 0.9466662 0.7783074
## cc 0.8716802 0.9267088 0.8610349 0.8161957 0.8780415 0.8722286 0.7462309
## ce 0.9063986 0.9042132 0.8811572 0.8212276 0.9377515 0.9368151 0.6897783
## ch 0.8097551 0.7502500 0.9300722 0.9375651 0.8499866 0.8618343 0.9087588
## cn 0.7650386 0.6992203 0.9153716 0.9364120 0.8097391 0.8261087 0.9530833
## cr 0.8114641 0.7572218 0.9441448 0.9655690 0.8557565 0.8582088 0.9623545
## ec 0.7574501 0.7639798 0.8461826 0.8612079 0.8124197 0.8273344 0.8001243
## ev 0.7909861 0.7832689 0.8567366 0.8627164 0.8409222 0.8456542 0.7863723
## fi 0.8841298 0.8325297 0.9251953 0.9144137 0.9274384 0.9392771 0.8373880
## gg 0.9314788 0.8903918 0.9563779 0.9212905 0.9673255 0.9467776 0.8197287
## gh 0.7230154 0.7118162 0.8702427 0.8677590 0.8009331 0.8106824 0.9266135
## hg 0.8271817 0.7852168 0.9040857 0.9172838 0.8742053 0.8873043 0.8483624
## ic 0.9068264 0.8350921 0.9885066 0.9630508 0.9225953 0.9201154 0.8813570
## in 1.0000000 0.9024135 0.9116993 0.8688565 0.9571063 0.9099998 0.7056564
## ip 0.9024135 1.0000000 0.8397574 0.7710357 0.9201391 0.9019321 0.6589804
## me 0.9116993 0.8397574 1.0000000 0.9621414 0.9321517 0.9245181 0.8652810
## mi 0.8688565 0.7710357 0.9621414 1.0000000 0.8904440 0.8763561 0.9144050
## ml 0.9571063 0.9201391 0.9321517 0.8904440 1.0000000 0.9688209 0.7613468
## mp 0.9099998 0.9019321 0.9245181 0.8763561 0.9688209 1.0000000 0.7681270
## mr 0.7056564 0.6589804 0.8652810 0.9144050 0.7613468 0.7681270 1.0000000
## uk 0.8343619 0.8064377 0.9141814 0.9166972 0.8798548 0.8900605 0.8279842
## uk
## ac 0.8574360
## ae 0.9377628
## cc 0.8322850
## ce 0.8480601
## ch 0.9141493
## cn 0.8905188
## cr 0.9069894
## ec 0.9507879
## ev 0.9603673
## fi 0.9340114
## gg 0.9030902
## gh 0.8280109
## hg 0.9842943
## ic 0.9122564
## in 0.8343619
## ip 0.8064377
## me 0.9141814
## mi 0.9166972
## ml 0.8798548
## mp 0.8900605
## mr 0.8279842
## uk 1.0000000
##
## $cor_plot
tictoc::tic()
s_dist <- chooseGCM::dist_gcms(s, var_names, study_area_parana, method = "euclidean")
tictoc::toc()
## 160.338 sec elapsed
s_dist
## $distances
## ac ae cc ce ch cn cr ec
## ae 538.1343
## cc 604.3074 447.1884
## ce 659.3407 368.1440 428.1462
## ch 343.5937 407.4816 541.2215 497.0297
## cn 211.7188 469.1428 570.6745 597.9558 295.2681
## cr 227.8255 426.9046 514.0575 545.9550 247.0457 172.8542
## ec 512.1413 368.3992 571.8520 538.0923 400.6371 454.2440 445.0859
## ev 534.3887 381.0957 532.8288 485.6411 393.5791 450.6683 449.5884 194.8830
## fi 478.1964 351.1936 462.8604 371.2283 379.6154 408.1962 373.8861 418.5490
## gg 515.8143 288.6104 449.9400 327.8409 402.6686 451.3716 378.3836 470.9597
## gh 383.2831 521.2385 609.7409 639.7178 436.1303 373.5573 361.4727 521.1489
## hg 441.9500 341.5042 539.9344 507.0789 377.7598 391.0651 372.0050 305.0511
## ic 403.0992 352.4522 441.8023 417.2605 294.4884 345.3571 271.9252 491.5408
## in 661.4328 411.5948 444.8457 379.9300 541.6502 601.9504 539.2119 611.5937
## ip 715.7385 393.0062 336.1927 384.3397 620.6049 681.0621 611.8815 603.3051
## me 425.0296 328.0185 462.9299 428.1036 328.3881 361.2606 293.4905 487.0406
## mi 338.2603 410.5411 532.4027 525.0646 310.2961 313.1484 230.4291 462.6417
## ml 595.7928 327.3852 433.6791 309.8324 480.9804 541.6730 471.6400 537.8438
## mp 571.1316 286.7898 443.8939 312.1541 461.5966 517.8469 467.6135 516.0187
## mr 180.9464 584.7067 625.5785 691.6694 375.1095 268.9839 240.9455 555.1911
## uk 468.8861 309.8044 508.5673 484.0591 363.8601 410.8963 378.7291 275.4852
## ev fi gg gh hg ic in ip
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi 376.9346
## gg 443.3753 272.1590
## gh 546.5196 457.1625 441.7743
## hg 292.2073 276.1169 378.1996 464.5351
## ic 461.9936 328.9509 284.6940 467.8709 390.1345
## in 567.7408 422.7157 325.0685 653.5672 516.2468 379.0608
## ip 578.1268 508.1962 411.1346 666.6490 575.5229 504.2933 387.9335
## me 470.0349 339.6464 259.3677 447.3304 384.5955 133.1332 369.0154 497.1088
## mi 460.1207 363.2993 348.3982 451.5913 357.1558 238.7069 449.7135 594.2188
## ml 495.2987 334.5153 224.4746 554.0666 440.4470 345.4985 257.1930 350.9372
## mp 487.8765 306.0122 286.4902 540.3286 416.8849 350.9895 372.5498 388.8892
## mr 573.9728 500.7706 527.2612 336.4114 483.5773 427.7436 673.7360 725.1905
## uk 247.2232 319.0047 386.5862 515.0068 155.6292 367.8494 505.4086 546.3524
## me mi ml mp mr
## ae
## cc
## ce
## ch
## cn
## cr
## ec
## ev
## fi
## gg
## gh
## hg
## ic
## in
## ip
## me
## mi 241.6267
## ml 323.4684 411.0367
## mp 341.1802 436.6653 219.2776
## mr 455.8026 363.3178 606.6611 597.9813
## uk 363.7921 358.4201 430.4431 411.7554 515.0468
##
## $heatmap
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3, method = "euclidean")
## $suggested_gcms
## 1 2 3
## "uk" "cr" "ml"
##
## $kmeans_plot
tictoc::toc()
## 160.818 sec elapsed
tictoc::tic()
chooseGCM::kmeans_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ic" "ch" "ev"
##
## $kmeans_plot
tictoc::toc()
## 157.689 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "cr" "ae" "hg"
##
## $dend_plot
tictoc::toc()
## 160.955 sec elapsed
tictoc::tic()
chooseGCM::hclust_gcms(s, var_names, study_area_parana, k = 3, n = 1000)
## $suggested_gcms
## [1] "cr" "ae" "hg"
##
## $dend_plot
tictoc::toc()
## 157.692 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana, k = 3)
## $suggested_gcms
## [1] "ce" "ch" "cr"
##
## $best_mean_diff
## [1] 0.009958008
##
## $global_mean
## [1] 430.0201
tictoc::toc()
## 157.717 sec elapsed
tictoc::tic()
chooseGCM::closestdist_gcms(s, var_names, study_area_parana)
## $suggested_gcms
## [1] "ip" "mp" "ic" "uk" "cr"
##
## $best_mean_diff
## [1] 0.007743907
##
## $global_mean
## [1] 430.0201
tictoc::toc()
## 158.426 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "wss", n = 1000)
tictoc::toc()
## 147.981 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "silhouette", n = 1000)
tictoc::toc()
## 146.827 sec elapsed
tictoc::tic()
chooseGCM::optk_gcms(s, var_names, study_area_parana, cluster = "kmeans", method = "gap_stat", n = 1000)
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
## Warning: did not converge in 10 iterations
tictoc::toc()
## 187.041 sec elapsed
tictoc::tic()
chooseGCM::montecarlo_gcms(s, var_names, study_area_parana, perm = 10000, method = "euclidean")
## $montecarlo_plot
##
## $suggested_gcms
## $suggested_gcms$k2
## [1] "ml" "uk"
##
## $suggested_gcms$k3
## [1] "ce" "ch" "cr"
##
## $suggested_gcms$k4
## [1] "ic" "mr" "hg" "ae"
##
## $suggested_gcms$k5
## [1] "ip" "mp" "ic" "uk" "cr"
##
## $suggested_gcms$k6
## [1] "fi" "ip" "cc" "ic" "mi" "hg"
##
## $suggested_gcms$k7
## [1] "ac" "in" "cr" "ch" "uk" "ev" "mr"
##
## $suggested_gcms$k8
## [1] "cc" "mp" "in" "mi" "ce" "ip" "fi" "hg"
##
## $suggested_gcms$k9
## [1] "ev" "ip" "ae" "fi" "ic" "cc" "mi" "ce" "ch"
##
## $suggested_gcms$k10
## [1] "ae" "gg" "gh" "ce" "cr" "uk" "ec" "cn" "ac" "mp"
##
## $suggested_gcms$k11
## [1] "ac" "in" "cr" "ch" "uk" "ev" "mr" "ec" "gg" "ae" "mp"
##
## $suggested_gcms$k12
## [1] "ce" "mp" "ev" "in" "hg" "ec" "ic" "cr" "cn" "ml" "ac" "ch"
##
## $suggested_gcms$k13
## [1] "gg" "ip" "uk" "in" "cc" "hg" "ce" "ev" "ic" "ch" "cr" "ec" "mp"
##
## $suggested_gcms$k14
## [1] "ip" "ml" "uk" "cc" "hg" "ev" "ce" "me" "mi" "in" "cr" "ch" "cn" "mp"
##
## $suggested_gcms$k15
## [1] "ev" "ip" "ae" "fi" "ic" "cc" "mi" "ce" "ch" "in" "hg" "cr" "cn" "ec" "mp"
##
## $suggested_gcms$k16
## [1] "ce" "mr" "cr" "ic" "mp" "uk" "ac" "ml" "ev" "ae" "ec" "cn" "gh" "gg" "in"
## [16] "fi"
##
## $suggested_gcms$k17
## [1] "cc" "ch" "cr" "ae" "ac" "mp" "hg" "ev" "ml" "ec" "cn" "mr" "gg" "gh" "mi"
## [16] "ce" "fi"
##
## $suggested_gcms$k18
## [1] "gh" "ip" "gg" "ml" "ce" "cc" "ic" "mi" "cr" "ch" "uk" "cn" "hg" "ev" "mp"
## [16] "ec" "ae" "in"
##
## $suggested_gcms$k19
## [1] "ce" "ec" "uk" "me" "cr" "ac" "ev" "mp" "ml" "cn" "mr" "ae" "gh" "fi" "ch"
## [16] "in" "hg" "cc" "ic"
##
## $suggested_gcms$k20
## [1] "cc" "ip" "me" "fi" "mi" "uk" "in" "ce" "cr" "ch" "cn" "mp" "ev" "hg" "ec"
## [16] "ml" "ac" "ae" "mr" "gg"
##
## $suggested_gcms$k21
## [1] "ac" "ce" "cr" "me" "hg" "ml" "mr" "mp" "gh" "ch" "ae" "ev" "cn" "ec" "gg"
## [16] "in" "uk" "cc" "ic" "mi" "ip"
tictoc::toc()
## 279.295 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = res30$suggested_gcms$k3)
tictoc::toc()
## 216.463 sec elapsed
tictoc::tic()
chooseGCM::env_gcms(s, var_names, study_area_parana, highlight = "sum")
tictoc::toc()
## 212.203 sec elapsed